lua-users home
lua-l archive

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


> > I noticed you decreased the maximum array size for sort from 2^50 to
> > 2^40 elements.
> > This actually brings it into range of real life operations. (it's not
> > unheard of to have 46bits of addressable memory now).
> > Though a single threaded sort operation might take a long time with
> > that much data,
> > Imagine the disappointment when your multi-month sort overruns your stack ;)
> 
> Real size is still limited by the size of an 'int', which in most
> machines is 2^31.

Another thing: the comment in the code is wrong. The recursion ends
with size 3 (not 1), so the real limit for a 40-slot stack is (2^42 - 1)
elements. Given that each element in a Lua has 2^4 bytes, we have
~2^46 bytes for the array, leaving little room for software in memory
(assuming 'bits' == byte :-).

-- Roberto