libretro / libretro-lutro

An experimental lua game framework for libretro following the LÖVE API
https://lutro.libretro.com
MIT License
149 stars 46 forks source link

audio: use rawgeti instead of gettable (perf) #203

Closed jstine35 closed 3 years ago

jstine35 commented 3 years ago

rawgeti bypasses metatable lookups (index overloading, essentially). We don't need to care about it.

Mostly this is pedantic, mostly that looking up refs in lua should probably always use rawgeti because it doesn't make sense to overload the behavior of ref tracking. Probably nothing good could ever come of it.

The perf improvement is negligible. 99% of the overhead is mixing the samples, not reading the sourcedata pointer from lua.