I want to use ChaiScript as primary in my project. Everything works amazing on iOS and Emscripten. But on Android I have issues.
I have critical lags(Android NDK 20C or any other).
Any call of chaiscript from c++ is very expensive(or break/continue during loops). Even empty function call takes about 25ms on Samsung S7.
I settled up profiler and found that NDK goes crazy when ChaiScript want to execute code like this:
Throwing exception kills all performance.
Stack is like this:
soinfo::gnu_addr_lookup(void const*) .... dlladdr helper(_Unwind_Context*, void*) __wrap___cxa_throw
As I understand this part responsible for unwinding stack during throw execution.
If I replace “throw” to “return” and add
std::stack to hold return values execution takes < 1ms.
it’s not a trivial case to rewrite code without using “throw”.
Does anybody have any suggestions?
Thanks in advance,