How to test performance of patches (in time)?

wiccy's icon

Hi guys,

Let's take the "Dynamics Tutorial 1: Envelope Following" as an example, there has 3 types of envelope following (Linear, Logarihthmic, Delta). How can I test which one is more computationally efficient?

In a programming language I can do some kind of timeit to see how much time each function takes. Is there anything similar we can do in Max?

Regards,

Pedro Santos's icon

With the "timer" object, you can count the time between the input and the output of the intended processing chain.

Max Patch
Copy patch and select New From Clipboard in Max.

Bill 2's icon

There's also [cpuclock].

Holland Hopson's icon

Does the profile.maxpat in Examples>utilities help?

One brute-force way I've tested for efficiency is to copy an object/abstraction 1000 times and run the patch. Then do the same with the alternative. With enough copies the very small differences between them can be discernible.