engine/3rdparty/sol2-3.3.0/documentation/source/performance.rst
things to make sol as fast as possible
As shown by the :doc:benchmarks<benchmarks>, sol is very performant with its abstractions. However, in the case where you need every last drop of performance from sol, a number of tips and API usage tricks will be documented here. PLEASE benchmark / profile your code before you start invoking these, as some of them trade in readability / clarity for performance.
sol::c_call<api/c_call>this note<function-argument-handling>.new_usertype function call and not relying on base lookup will boost performance of member lookupsol::stack_{}<api/stack_reference> versions of functions in order to achieve maximum performance benefits when doing things like calling a function from Lua and knowing that certain arguments of certain Lua types will be on the stack. This can save you a very small fraction of performance to not copy to the register (but is also more dangerous and usually not terribly worth it).bottom of the usertype page<api/usertype>); until we find out a safe way around this, member variables will always incur that extra lookup costWorking with things that are already on the stack can also boost performance. Last time regular, call overhead was measured, it was around 5-11 nanoseconds for a single C++ call on a recent (2015) machine. The range is for how slim you make the call, what kind of arguments, et cetera.
If you find some form of the performance unacceptable to you, also feel free to open an issue at the github.