|Compared to lua 5.2.4, for my usecase I've noticed that 5.3.0 uses roughly 2x the amount of memory and is 1.5x slower. And Lua 5.3.3 is again 2x slower and uses > 4x the amount of memory than 5.3.0.|
Maybe this is by design in lua 5.3. Or maybe this is user error on my end, or some kind of bug in my code. But I'm hoping for insight into the cause as I would like to be able to use the latest lua 5.3.x series.
The program I'm seeing this with is osrm-backend, a tool used to process the 35 GB http://wiki.openstreetmap.org/wiki/Planet.osm into a graph structure for routing.
Testing is being done on r3.8xlarge amazon instances running ubuntu trusty with 32 vCPU and 244 GB ram.
In osrm-backend lua is embedded and called from C++. The section of code that is running slower with lua 5.3, compared to 5.2.4, is https://github.com/Project-OSRM/osrm-backend/blob/master/src/extractor/extractor.cpp#L184-L208.
That "extractor.cpp` code uses parallelization via intel threading building blocks: https://github.com/Project-OSRM/osrm-backend/blob/master/src/extractor/scripting_environment_lua.cpp#L258-L306
Luabind (https://github.com/mapbox/luabind) and a few utility functions (https://github.com/Project-OSRM/osrm-backend/blob/master/include/util/lua_util.hpp) are used to allow the C++ to call into lua. Lua scripts like https://github.com/Project-OSRM/osrm-backend/blob/master/profiles/car.lua are executed.
Given the above, does anyone have ideas about what might cause Lua 5.3.x to be slower and use more memory? Are there modifications I can make when building lua 5.3 or other things I could test to try to see if memory usage of lua 5.3 can be reduced?
Thanks for any ideas,