[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: luaO_chunkid - supply string size as parameter instead of calling strlen()
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 2 Apr 2019 17:32:05 -0300
> FWIW: While profiling the startup time of a somewhat big project with a
> debug hook calling auxgetinfo -> funcinfo a lot, we noticed luaO_chunkid
> calls strlen on its const char *source argument.
> All the places where luaO_chunkid is called in the Lua source, however,
> have this string length readily (and cheaply) available, either from a
> TString *, or from a string literal.
> We patched it locally, saving almost 100 mln strlen calls on startup.
> IMHO the change is small and painless enough - an additional parameter to
> luaO_chunkID, and a couple of tsslen() macros where it's called - to be
> considered for a future inclusion. Or am I missing something?
You are not missing anything. Thanks for the suggestion.