lua-users home
lua-l archive

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


I tried it, and the running time of the test code reduce to zero second.
I think maybe this is more adaptable to various situations if lua code change like that.

thank you.


At 2021-03-10 22:35:09, "Roberto Ierusalimschy" <roberto@inf.puc-rio.br> wrote:
>> >Is yours a real problem? Do you have a program that does something
>> >useful to someone that is having performance problems because of
>> >this hashing?
>> yes, I am a online game server developer, and we use Lua to write the whole game's logic.
>> this is the real problem that happened in our server which stuck the server about 10 seconds.
>
>If you can change the code of your Lua implementation, you can try the
>following:
>
>In file 'ltable.c', change the definition of 'hashint':
>
>-#define hashint(t,i)           hashpow2(t, i)
>+#define hashint(t,i)           hashmod(t, l_castS2U(i))
>
>See if that helps and report back to us.
>
>-- Roberto