general tips for reducing CPU load


    Nov 18 2018 | 9:28 pm
    Hi guys, I've been searching for hours and couldn't find good general advice on how to reduce CPU load. I know that GUI objects are huge consumers, but apart from that should I look for something else? Also is there a way to measure this by myself? I found a time benchmark time patch (not sure about its creator, but I think it could be Chris Muir), which measures some time, however I'm not sure about some reference ranges, and is it actually the best one?

    • Nov 19 2018 | 4:17 am
      i am not an expert for this low level stuff, but i think that for scheduler rate data, measuring how long they take to be processed by the objects above the target point is perfectly describing the "CPU requirement" of the algorithms.
      and it is that what you usually want to know: if something still runs fine within its thread.
    • Nov 19 2018 | 7:23 am
      patch: thats milliseconds of system time
    • Nov 20 2018 | 6:47 pm
      1) I was basically asking for some general advice on how to reduce CPU load, not something too low level. I've got couple of patches which quite easily hit the 100% load every now and then, and would like to fix that. 2) As a result the benchmark showed 5.5ms for a meter~ vs 3.3ms for a simple message object, and 2.1 for a number~, which I thought was supposed to be heavier than [message]. I am confused.
    • Nov 20 2018 | 7:20 pm
      There's tons of other stuff you can be looking at before you start looking at the scheduler and UI objects. It's good practice to limit those, but where you will be spending big % will be on audio processes.
      In the "View" menu there is a "Show CPU Usage" option. Turn that on and take a look at your patch. Also, when you turn it off, it prints off what % of your total CPU is being used by each individual object, and lets you double-click to go to that object.
      That will help you identify your problem areas.
      From there, it varies by what you're are doing (seeing a patch helps), but you normally want to disable parts of your patch that aren't presently in use. This normally happens by wrapping it inside a [poly~] object, and turning it on/off that way. But again, this varies a ton by what you're doing.
    • Nov 20 2018 | 7:41 pm
      Thanks Rodrigo, pretty good advice to use the CPU Usage. I was using the DSP CPU Monitor found in Extras, but it didn't show me such information. You said that once I turn CPU Usage off I should be able to see exactly what % is used by each individual object, but I can't see that. Can you please share a screenshot?
    • Nov 20 2018 | 7:45 pm
      It will be in the Max window, which may be hidden or closed.
      Here is a screenshot of a relatively simple patch:
      It's worth noting that the percentage that it lists for each object is of the total listed at the top.
      So in this case my average audio usage is 0.79%, of which the object [karma~] is 72% of.
    • Nov 20 2018 | 7:49 pm
      Hi Raja, again plenty of interesting information to consider from your side. I realise that I find the work with poly~ cumbersome and usually that's my last resort (i know.. i have to start loving it for its benefits, and yet..). However I'm not sure if this would help in my case - it's about a synth I'm building, consisting of 3 oscillators, each having a choice of waveforms - sine, triangle, square etc + custom wave, for which i was using multislider with 512 sliders, peek~ and a buffer~. Unfortunately I see that the combination of these 3 objects results in pretty huge CPU load (as per the benchmark) - 5000msec! So I had to remove that option from the first two OSCs and leave it only for the third one.
    • Nov 20 2018 | 7:53 pm
      Rodrigo, that's pretty cool. Thanks!!
    • Nov 20 2018 | 8:08 pm
      Yeah it's not very clear, but I've deduced it after seeing many patches like this one (there's no way that karma~ is using 72% of the total CPU!).
    • Nov 20 2018 | 8:18 pm
      It's particularly nice as it jumps you to the object (like a normal error report), so when it says "poly~", you know which one.
    • May 15 2020 | 9:44 am
      The CPU usage percentage list (broken down by object) mentioned and screenshotted by {the amazing} Rodrigo, appears for me *after* I close my M4L patch.
    • May 23 2020 | 4:16 pm
      Hi everyone - I can't seem to access this CPU usage list... I have selected it on the patch I want to show, and have the max console up, but nothing coming up. Any ideas? Thanks in advance. On Max 8.1.3...