[Freeswitch-dev] mod_lua speed up

Vicente Hernando vhernando at systemonenoc.com
Wed Apr 24 14:52:53 MSD 2013


looking at src/mod/languages/mod_lua/mod_lua.cpp

I see executing lua_init lua_uninit at the beginning and end of every 
function, then a lua script is loaded from a buffer, compiled and executed.

Another approach could be loading some lua scripts at the beginning and 
compile them. Then create a pool of lua states.

Now everytime lua_init is called, instead of initializing lua again, it 
would take a lua state from the pool if available, otherwise it would 
create a new one.

lua_uninit would reintegrate a lua state into the pool again.

At the end, when module is finished being used, the whole pool should be 

Do you thing it is a worthwhile idea or a crazy idea? Any points?

Thanks in advance,

Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-dev mailing list