lua-users home
lua-l archive

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


Lua 5.4.1 on slackware-current (64-bit libraries only, Linux kernel 5.4.69) with 16GB RAM, nothing else of significance going on.

With the non-integer key ‘slow’ in the table:

77.9 seconds

Without it:

33.8 seconds

That ratio of about 2.3-to-1 (78/34) shows up repeatedly.

(I upped the loop to “j=1,1e9” otherwise it ran too quickly to give useful measurements, though at “j=1.1e8” I got similar results with 7.6sec and 3.3 sec.)



> On 30 Sep 2020, at 14:14, Egor Skriptunoff <egor.skriptunoff@gmail.com> wrote:
> 
> Hi!
> 
> This program runs very fast:
> 
> local t = {}
> -- t.slow = true
> for j = 1, 1e6 do t[j], t[-j] = 0, nil end
> 
> But if you uncomment the line with the "slow" option...
>