3 ms·
I'm curious to do some performance comparisons, can you perhaps say how one would build and run your code to replicate those benchmark results? (Especially but
by azakai 14y ago
I'm curious to do some performance comparisons, can you perhaps say how one would build and run your code to replicate those benchmark results? (Especially but not only the one you say was faster in LuaJIT?)
- graue 14y agoI documented the tests on my project log: https://scott.mn/projects/luasynth.html#filter_effect https://scott.mn/projects/luasynth.html#filter_effect In short, I ran C and Lua implementations of the same command, 6 times each, using the built-in "time" command in bash. Averaged the "user" time for each implementation and compared the results. As input, I used a 2m:38.040s long song, 44.1 KHz stereo, converted to a raw file with 32-bit float samples, and I redirected output to /dev/null. For the first benchmark[1], which was faster for LuaJIT, I actually messed up: I compared the "real" time rather than the user CPU time. But as I recall, the "user" times bore the same relationship, and there was very little deviation among the six trials. If you don't trust me, feel free to do a more rigorous test! It's worth mentioning that the effect for which LuaJIT beat C was a simple gain, so what was really being tested was a loop that multiplied a bunch of numbers by a (within the loop) constant. The second test in which Lua was a factor of two slower may be more representative. To build the code, clone the graue/synth and graue/luasynth repos on GitHub. synth includes build instructions, while Luasynth merely requires you to install LuaJIT and run the script. [1]: https://scott.mn/projects/luasynth.html#lua_beats_c https://scott.mn/projects/luasynth.html#lua_beats_c
- azakai 14y agoThanks!