lua-users home
lua-l archive

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

Roberto Ierusalimschy wrote:
> You can make the code ~20% faster using local variables:
>   function sieve(n)
>     local x = {}

>From the "correctness" perspective x should be a global variable,
otherwise your would not be able to read the sieve list afterward.. But
from a performance perspective it interesting to know what the
performance gain is with local variables.

But what we should do is create a static benchmark suite of functions so
we can compare each others inplementations, different compilers, OS'ses
etc.. and that benchmark should include both local and global variables.

I was think about adding a recusive function to test the stack depth
performance .. Other suggestions ?