Hi there, I’m working on a new module and have noticed that CPU usage is kinda high. I’d like to make it more efficient but want to where I should focus my efforts so I want to do some profiling on my code.
However, I am not very experienced in profiling and have not been able to find good resources for how to do it for Rack plugins. Does anyone have tips or pointers for how to get starter profiling my module? Is there a preferred tool? I currently build my plugin with the Rack SDK and make install it and just run my downloaded Rack app. Would I be profiling all of Rack? Is there a way to profile my module specifically?
For context, I am developing on an M1 Mac (building for x86).
yeah, I run on windows, and sometimes in Linux. I don’t really want to learn how to use a new profiler, so I never have. As in never, ever, not once. I have run other tools on my modules, but never a profiler.
The documents that @LarsBjerregaard pointed you to are for sure good and correct. In general, anyway. In general it’s true you have no idea where the bottleneck is, and it’s never where you might guess.
But a VCV module is not “general”. It’s not a big program like VCV where you need a profiler. You know exactly where the bottleneck is - it’s in your process function! By definition.
If your process function is longer than 100 lines you are doing something wrong. It’s either obvious where the problems is (if you have a lot of experience), or it’s easy to find it. Like I say, if you have no idea just remove half the code. It won’t take very long to get to the very line that’s the problem.