[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Backport of Lua 5.2 "in" scoping (was Re: Lua registry, environment, and threads.)
- From: Mike Pall <mikelu-1001@...>
- Date: Thu, 14 Jan 2010 21:46:30 +0100
Dirk Feytons wrote:
> On Fri, Jan 8, 2010 at 7:17 PM, Mike Pall <mikelu-1001@mike.de> wrote:
> > Yes, I did that in LuaJIT 2.x, too. I've also put the prototypes
> > objects themselves into the constants table to avoid managing an
> > extra growable table. And the constants table is type-specialized
> > (GC objects below pt->k, numbers above pt->k) to reduce memory
> > usage.
>
> I think that I can speak for everybody who uses Lua on embedded
> devices when I say: could this be made available as a patch for Lua
> 5.1?
Changing the layout of the constants table would require extensive
modifications to plain Lua. The code from LJ2 cannot be easily
backported.
> Do you have any numbers on the reduction in memory usage obtained
> with these changes?
Here's a small example which loads two files of DynASM, a simple
3000 line app written in Lua which uses quite a few constants:
collectgarbage()
local x = collectgarbage("count")
local a = loadfile("dynasm.lua")
local b = loadfile("dasm_x86.lua")
print((collectgarbage("count")-x) * 1024)
It prints out the number of bytes needed to hold all the
prototypes defined in the two files. Lower numbers are better:
x86 x64
----------------------------------
lua-5.1.4 335807 453755
luajit-2.0.0-dev 217307 226995
So, yes, I'd say the reduction is significant.
--Mike
- References:
- Re: Lua registry, environment, and threads., Patrick Donnelly
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy
- Re: Lua registry, environment, and threads., Enrico Colombini
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy
- Backport of Lua 5.2 "in" scoping (was Re: Lua registry, environment, and threads.), Mike Pall
- Re: Backport of Lua 5.2 "in" scoping (was Re: Lua registry, environment, and threads.), Matthew Wild
- Re: Backport of Lua 5.2 "in" scoping (was Re: Lua registry, environment, and threads.), Mike Pall
- Re: Backport of Lua 5.2 "in" scoping (was Re: Lua registry, environment, and threads.), Roberto Ierusalimschy
- Re: Backport of Lua 5.2 "in" scoping (was Re: Lua registry, environment, and threads.), Mike Pall
- Re: Backport of Lua 5.2 "in" scoping (was Re: Lua registry, environment, and threads.), Dirk Feytons