[PATCH] Tunable LJ_MIN_STRTAB

  • From: "Yichun Zhang (agentzh)" <agentzh@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Mon, 17 Mar 2014 15:59:35 -0700

Hello Mike!

For our web apps creating a lot of short-lived Lua strings, we've
noticed from our C-land on-CPU Flame Graphs that the lj_str_new is
taking a lot of time. Further investigation shows that it is because
the bucket collision rate in the global string hash table is quite
high due to the relatively small bucket count.

Increasing LJ_MIN_STRTAB to a larger value, say, 4096, helps reducing
the overhead of lj_str_new() a lot according to the flame graph.

So I'm wondering if we can make the LJ_MIN_STRTAB constant tunable
from the make command line without patching the source code directly:

    http://agentzh.org/misc/luajit/lj21-min-strtab.patch

What do you think?

Thanks!
-agentzh

Other related posts:

  • » [PATCH] Tunable LJ_MIN_STRTAB - Yichun Zhang (agentzh)