I have a lua code where a certain table (lets say 'abc') has 50,000 key value pairs. Now i want to create a long string which will look like "(key1, value1) (key2,value2) (key3, value3) ... ".
This works for tables with smaller number of elements. for 50,000 it works but the pc becomes very very slow. Is there a way around this ?
I tried inserting in to another table and then concatenating since the string concatenation in lua is expensive but still the performance penalty is there
local pqr = {}
for key, value in pairs(app_revenue) do
table.insert(pqr, "(")
table.insert(pqr, key)
table.insert(pqr, ",")
table.insert(pqr, value)
table.insert(pqr, ") ")
end
local x = table.concat(pqr)
Any insight on this issue is much appreciated. Thank you
app_revenue? I did a test with this and it doesn't seem that slow. On my machine it finished in 0.381 seconds. On repl.it it took less than 2 seconds to finish which isn't too bad considering it's interpreted inside a javascript vm. - greatwolf