lua-users home
lua-l archive

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


Here's a simple program to demonstrate the effect:

local a = {}
local last_time = os.clock()
for i = 1, 2e6 do
    local s = ("%016d"):format(i):gsub(".","%0_")
    a[i] = s
    if i % 10000 == 0 then
local time = os.clock()
io.write(("%d %.2fs (total %.2fs)\n"):format(i, time - last_time, time))
io.flush()
last_time = time
    end
end


It takes longer and longer to add another 10000 strings.


--