lua-users home
lua-l archive

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


unsubscribe

 

 

Patrick Dorion

📱 +1 438 345-4575

 


From: lua-l-bounces@lists.lua.org <lua-l-bounces@lists.lua.org> on behalf of Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Sent: Tuesday, April 2, 2019 4:32:05 PM
To: Lua mailing list
Subject: Re: luaO_chunkid - supply string size as parameter instead of calling strlen()
 
> 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.

-- Roberto