Re: Gen~ efficiency comparison


Forums > Gen > Gen~ efficiency comparison
May 22, 2012 | 3:56 pm

Hi there,

Gen *can* result in better performance than using MSP objects, but this can’t be guaranteed in all cases. In general, Gen patchers start to show better performance compared to MSP patching as the number of objects and connections increases. Not only does this amortize the unavoidable overhead of the gen~ object itself, it also allows for much greater compiler optimization within the patch (which simply isn’t possible for MSP patchers).

I have attached a performance testing patch which creates 20 copies of a particular operator, and connects them up randomly. It then generates both MSP and gen~ versions, and alternately hosts them in a poly~ with 32 voices.

The results clearly show that for many operators the difference is quite significant even with only 20 boxes, but some operators have similar performance and a few (here trunc and mod) are worse.

We are focusing efforts to improve these particular operators for the 6.0.7 release, however over the last few months we have been making major changes to the internals of Gen, and have been balancing the importance of performance improvements with the addition of major user-requested features.

: nothing.maxpat: avg 0. max 1.

: test_empty_gen.maxpat: avg 0.8 max 1.
: test_empty_msp.maxpat: avg 0.1 max 1.

: test_add_gen.maxpat: avg 2. max 4.
: test_add_msp.maxpat: avg 6. max 10.

: test_cos_gen.maxpat: avg 25.3 max 37.
: test_cos_msp.maxpat: avg 50. max 67.

: test_delay_gen.maxpat: avg 22.1 max 31.
: test_delay_msp.maxpat: avg 51.1 max 69.

: test_delta_gen.maxpat: avg 4.1 max 8.
: test_delta_msp.maxpat: avg 7.3 max 12.

: test_div2_gen.maxpat: avg 2. max 3.
: test_div2_msp.maxpat: avg 6.1 max 10.

: test_div_gen.maxpat: avg 21.6 max 33.
: test_div_msp.maxpat: avg 23.9 max 38.

: test_gate_gen.maxpat: avg 4.2 max 7.
: test_gate_msp.maxpat: avg 17.2 max 34.

: test_log_gen.maxpat: avg 30.3 max 43.
: test_log_msp.maxpat: avg 60.4 max 79.

: test_maximum_gen.maxpat: avg 1.9 max 5.
: test_maximum_msp.maxpat: avg 6.4 max 12.

: test_mod_gen.maxpat: avg 61.1 max 95.
: test_mod_msp.maxpat: avg 15.5 max 30.

: test_mul_gen.maxpat: avg 2.1 max 4.
: test_mul_msp.maxpat: avg 6.4 max 12.

: test_noise_gen.maxpat: avg 6.5 max 11.
: test_noise_msp.maxpat: avg 10.3 max 21.

: test_phasewrap_gen.maxpat: avg 12.5 max 19.
: test_phasewrap_msp.maxpat: avg 13.8 max 27.

: test_poltocar_gen.maxpat: avg 21.7 max 32.
: test_poltocar_msp.maxpat: avg 100.5 max 100.

: test_sqrt_gen.maxpat: avg 3.2 max 6.
: test_sqrt_msp.maxpat: avg 21.7 max 37.

: test_trunc_gen.maxpat: avg 17.9 max 26.
: test_trunc_msp.maxpat: avg 7.2 max 14.

Tested with Max 6.0.5 (1741622)
Mac OS 10.6.8
2 GHz Intel Core i7, 4GB 1333 MHz RAM.