Max/MSP Test 03 :: [pack] vs [pak] vs [prepend]
I’ve seen a lot of people using [pak] to pair a dynamic input to another, static value. I wanted to see how efficient it was instead of using [pack] or [prepend]/[append].
I’m not going to write up a full report on this one. I figure this should be a case take it or leave it kind of deal.
The Test
Obviously there’s going to be cases you want to use all of these methods, and each will differ. In specific cases, however, multiple methods can do the same thing, and one will process the data faster than the others.
In this test I jump 10,000 acceding values from an [uzi] into the test objects, timing how long it takes to process them all. Each test result is an averaged millisecond value over 100 iterations of the tests.
Here are my own take-aways from this test:
- if you need to join a dynamic value to a static value – use [prepend] / [append] – it’s just faster
- the left input on a [pak] is WAY faster than the right inlet
- when joining two dynamic inputs, using [pak] or [t b i] -> [pack] doesn’t make a difference speed-wise, but [pak] is more convenient
Results
METHOD | EXECUTION TIME (ms) |
---|---|
Pack (left) | 0.62 |
Pack (right) | 1.19 |
Pak (left) | 0.63 |
Pak (right) | 0.95 |
Append | 0.57 |
Prepend | 0.55 |