Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize tic api call performance in LUA.
Previously, the tic_core* was associated with a global variable named "_TIC80" and every api call fetches the tic_core by finding the global with this name. Finding the global variable with that name took surprising amount of time, according to profiling. With this optimization, each API function is associated with tic_core* through lua_pushcclosure mechanism. Closures are functions that are associated with certain "upvalues". Fetching an upvalue is very fast in LUA. checkForceExit still fetches the tic_core from the global, as the hook is an ordinary function, not a global.
- Loading branch information