lua-users home
lua-l archive

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


> I believe the difference is because I made 'composite' an array with 
> contiguous numerical indexes, with optimized access in Lua 5.1 (direct 
> offset computing), while in the previous code, Lua probably has to make 
> more complex tests (hashing the index?) to see if the slot is empty.

This is my guess, too. You can check by initializing the "prime" array
with falses before starting the sieve (as you do with 'composite').

-- Roberto