lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

after this really hot discussion I made a first version of Lua
with unified methods.  If anybody is interested a patch is at
http://user.exit.de/froese/lua/lua-4b-um1.patch

About the performance - it's as expected: nearly the same as
the original.

             Lua-4.0b     Lua-4.0b-um1
exec-size    81544        81088
t1.lua       3.07s        3.04s
t2.lua       6.96s        7.06s

(Note: Lua-4.0b-um1 still contains compatibility functions.)

---t1.lua---
local a={}
for i=1,1000 do a[i]=i end
for i=1,1000 do for j=1,1000 do a[j]=a[i] end end

---t2.lua---
local a={}
settag(a, newtag());
settagmethod(tag(a),"settable",function(t,i,v) rawset(t,i,v) end)
for i=1,1000 do a[i]=i end
for i=1,1000 do for j=1,1000 do a[j]=a[i] end end

(Note: t2.lua uses the compatibility functions.)

One thing's still missing.  The ordering of the gc callbacks.
At the moment they are called in no specific order.  One
way would be to include a gcpriority field in the method 
table and call them in that order.  But that requires a kind
of sorting...

Ciao, ET.


PS: The get/setglobal methods are gone.