New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Faster insertion into table #3448
Conversation
👍 |
What about Lua vs. LuaJIT? Is it better for both? Also you probably shouldn't waste your time optimizing non performance critical code. |
My timings (with iterations multiplied by 1000 for better sample size):
This doesn't matter unless the code is very performance-critical though. |
We don't use 5.3 we use 5.1. |
@est31: Yes, but I don't have Lua 5.1 installed, I'd have to turn the script into a mod and run it through Minetest by starting a world. |
doesn't seem to cause side effects on non indexed (key based) tables too |
come on guys this is a minor change can those denying it please explain why? |
From reading http://www.lua.org/manual/5.1/manual.html#2.5.5 I saw that #tablename +1 is guaranteed to be nil. thats very fine 👍 if the whitespace issue ( |
Updated. |
👍 looks good |
Rebased. |
👍 Will merge soon. |
minetest/minetest_game#732
table.insert :
0.00020699999999996
tbl[#tbl+1] :
0.00011100000000003