Viewport's CPU Usage



I have built a sequencer using a ViewPort and discovered that when I scroll it the CPU meter is going crazy.
I did some searching here and found Jules response for that (“Ban CPU meters” - )

That sounds logical, the thing is that I benchmarked my sequencer against major DAW’s sequencers,
and their CPU meter was barely affected by the scrolling.
I’m trying to understand it, do they enforce some constraints on the painting rate or stuff like that? what’s the secret?

I don’t want some ignorant people mock my lovely sequencer because they didn’t read Jules’es post.



I’m pretty good at my job; but not so good that I can psychically tell you how to optimise an app that I’ve never even seen.

Tracktion scrolled without any problem, but you have to bear in mind that the whole screen gets redrawn each time it moves, so your components need to be super-efficient at redrawing. Most likely your problem isn’t the actual rendering at all, it’ll be the work required to calculate the stuff you’re redrawing, so you might need to cache things intelligently.


My sequencer has a background component and a notes component on top of it, so what it did was to disable painting of both components
(empty paint()) I also disabled every related callback ( visibleAreaChanged() …) but still I have this CPU problem.


And when you profiled it, where were the hotspots? (I’m assuming you have attempted to profile your app before asking for help, right?)


Nope, you’re right, I was too hasty.
I’m using the Visual’s profiler, it’s all painting methods, trying to find the problem…