Ableton / link

Ableton Link
Other
1.09k stars 149 forks source link

examples/linkhut/play.cpp is ... well, suboptimal #101

Closed Arakula closed 3 years ago

Arakula commented 3 years ago

The thread function void input(State& state) ends with a call to input(state);. This means that whenever a key is pressed, another call address (plus some local variables) is needlessly pushed onto the stack. While this should not be a big problem on today's machines (unless you let a rabid monkey hammer on the keyboard), it would definitely be better to enclose the logic in input() in a do { ... } while(true); loop instead.

fgo-ableton commented 3 years ago

Makes sense. I wrapped the input handling in a loop: https://github.com/Ableton/link/commit/c05a176cbe6c865f925f944c2dc497734431498c

Just out of curiosity, are you running Link on a platform where this is actually a problem?

Arakula commented 3 years ago

Me? No. I'm working on Windows, and it would presumably require days of constant space bar mistreatment to come close to a point where the memory usage difference would become visible. I'm just carefully examining the LinkHut example as it seems to be the best documentation available.