lua-users home
lua-l archive

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


Hi,

Don Hopkins wrote:
> Hmm... Could it be that storing into a table starting at index zero 
> makes Lua use more memory (bypassing a table optimization for numeric 
> indexes starting at one)? Can anyone think of how to optimize this Lua 
> implementation of fannkuch to use less memory?
> 
> http://shootout.alioth.debian.org/gp4/benchmark.php?test=fannkuch&lang=lua&id=0 

Umm, how did you manage to get this ancient version of the
benchmark?

The current one is:

http://shootout.alioth.debian.org/gp4/benchmark.php?test=fannkuch&lang=lua&id=3

And yes, of course it's using 1-based indexing (and other
tricks). And a lot faster.

Oh, and I wouldn't worry about the memory use. The measurement is
not accurate at all (a process runnning in parallel and peeking
at the process stats). Have a look at the full data (the startup
overhead is already subtracted, otherwise JS would look much
worse):

                              N=8      N=9     N=10
JavaScript SpiderMonkey #2   14,488  154,332 192,120
Lua #3                       16,476   16,480  16,512

;-)

Bye,
     Mike