in code: -- 1.088 (time ) \ 230 (mem size (mb) in proc. manager) \ 197078 (gcinfo() size in kb)
Code: Select all
for i = 1 , 3000000 do
local x = math.random(1,100)
local y = math.random(1,100)
local z = math.random(10,100)
-- testtable[i] = {x, y} -- 1.088 \ 230 \ 197078
-- testtable[i] = {x, y, z} -- 1.1 \ 256 \ 220516
-- testtable[i] = {[0] = z, x, y} -- 1.120 \ 230 \ 197080 -- ???
-- testtable[i] = {[0] = x, y} -- 1.090 \ 230 \ 197078 -- ???
-- testtable[i] = {[0] = x} -- 1.025 \ 230 \ 197078
-- testtable[i] = {[0] = x,nil} -- 0.940 \ 211 \ 173642 -- ???
-- testtable[i] = {[0] = x} -- 1.000 \ 230 \ 197078
-- testtable[i] = {[0] = x, [1] = y} -- 1.000 \ 394 -- ???
end
e.g - i can store {[0] = z, x, y} at same size of {x, y} ?
and:
Code: Select all
-- testtable[i] = {[0] = x} -- 1.025 \ 230 \ 197078
-- testtable[i] = {[0] = x,nil} -- 0.940 \ 211 \ 173642 -- ???
Example 2 -- I do not understand this:
Code: Select all
test_2 = {}
for i = 1 , 1000000 do
-- local tpl = {[0] = "node",[1] = "label x "..i,[2] = 100200} -- / 152
-- local tpl = {[0] = "node",[1] = "label x ",[2] = 100200} -- / 88
-- local tpl = {[0] = "node",[1] = i,[2] = 100200} -- / 88
-- local tpl = {[0] = i,[1] = "node",[2] = 100200} -- / 125 ???
-- local tpl = {[0] = "label x "..i,[1] = "node",[2] = 100200} -- / 183 ???
-- local tpl = {"node","label x "..i,100200} -- / 167 ???
-- local tpl = {[0] = "node",i,100200} -- / 88
-- local tpl = {"node",i,100200} -- / 102
-- local tpl = {i,"node",100200} -- / 102
-- local tpl = {["n"] = "node",["l"] = "label x "..i,["h"] = 100200} -- / 220
-- local tpl = {"node @ label x "..i, 100200} -- / 157
-- table.insert(test_2, tpl)
end
- different size, but:
{"node",i,100200} and {i,"node",100200} - some size O_O
and last, if {[0] = "node",i,100200} smaller, than {"node",i,100200}, then why testtable = {[0] = x, y} - 197078 and testtable = { x, y} - 197078 -- some size ?