CPU, DSP Status vs Activity Monitor

Mike S's icon

Firstly, Shark has been really useful for tracking down what objects are using CPU. My problem now is figuring out why there is such a difference in CPU when comparing the DSP Status window to Activity Monitor.

Here are the idle readings (polys~ muted etc)

DSP Status - 5-6%

Activity Monitor - 35%

Mike S's icon

Ah OK, so now it's how to reduce the non DSP processing!

There are a few threads on that I think (getting rid of number boxes/ unnecessary objects) Are there any objects I should specifically look out for?

Mike S's icon

Thanks Vanille,

Is it safe to assume that the CPU with the audio turned off are the non audio processes?

Mike S's icon

Attached is the readout from Shark with the audio off when the patch is first loaded.

Max/MSP on its own with audio off in Activity Monitor takes about 6% CPU,

The CPU in Activity Monitor with the patch loaded and audio off is roughly 26%

The readout from Shark shows Max at roughly 12% with audio off, leaving 8% somewhere else?!

Is the CPU reduction more of a question of trial and error, or can anyone make sense of the Shark data? Or perhaps both?

Thanks again

1769.cputest.jpg
jpg
Emmanuel Jourdan's icon

Shark might be useful to find the objects which really takes continuous usage of CPU, such as DSP objects.

Mike S's icon

Hi Emmanuel,

Yes, I've used Shark to tweak the DSP objects, it is indeed great for that. My problem now is making sense of that data, or more likely finding the objects that are causing this idle CPU %

@ Vanille, I think trial and error is indeed the way forward, thanks again

Emmanuel Jourdan's icon

You can't go further than what you did. Basically now you see that you have a bunch of things that are redrawing, and that's taking more CPU than the actual calculation of the patcher. I wouldn't worry too much about the idle processing, although this has been widely improved in Max 5 compared to Max 4, Max will always take some CPU while doing "nothing", the scheduler has to be maintained ready, among other things.

Mike S's icon

I can always use fewer objects (I have already got rid of quite a few, and can get rid of more) What is redrawing? Is it related to graphics?

RE the idle processing, I'm not concerned about Max itself, obviously I can't do anything about that. But I presume that less objects = less CPU, so at least I can try and optimise the 'Max' side of the patch?

Emmanuel Jourdan's icon

- don't lose your time to gain 1 % !

@vanille, That's the key point! Don't optimize unless you need to. (I'm less optimistic on the sprintf comment though ;-)

Mike S's icon

Thanks again guys. The reason I'm conscious of CPU is that I am going to sell the application commercially.

Emmanuel Jourdan's icon

oh yeah sorry I misread your post. sprintf is definitely slower, and that's not his job anyhow ;-)