mirror of
https://github.com/edubart/otclient.git
synced 2025-05-01 18:19:20 +02:00

lua_newtable() definition: #define lua_newtable(L) lua_createtable(L, 0, 0) This simply allocates space for 0 fields, meaning, if we push any values into this array, it will re-allocate the array, which is bad. This function statically allocates an array, so it's ready to have X fields into it. Performance tests: lua_newtable 1428161 1426992 1413513 lua_createtable 2004544 1974117 1957533 These tests were done on an AMD 8350fx CPU, single thread used. narr: This is for fields that just have an index, e.g. arr[0] etc. nrec: For fields which needs like arr.a, arr.b etc. This is how many times each of the functions can run per second, as you can see about 1.7x the calls to lua_newtable. All credits goes to @dalkon, he was too lazy to do it by himself, and asked me to do it for him.