If there is more than one cpu available, BEAST automatically uses more than one
cpu for computing the actual audio output. I tried to figure out if this in
fact helps to make things faster.
The test: on my system (8 threads maximum), render party monster as quickly as
possible, with 1-8 cpus, and measure the real time it takes to complete the
job. I also tested different block sizes, from 64 to 1024.
Ideal result: using more cpus should speed up computation, ideally using two
cpus would make things twice as fast, using three cpus would make things three
times faster and so on.
Actual result: adding more cpus makes things go slower (all times in seconds,
less is better), for all block sizes:
Why is it slower with more cpus? This is difficult to guess from this test
alone, but I believe that using two cpus (or more) will lead to more overhead
from synchronization. Also if we just use one cpu, this cpu will have all the
memory needed to do the synthesis in its cache, whereas if we use more than one
cpu, the memory touched by one cpu will have to be transferred to another cpu.
For smaller block sizes the slowdown caused by using multiple cpus is more
extreme than for large block sizes, but using only one cpu is always the
If I had to guess what should be done to improve this, I'd say we could group
related computations, and use the same cpu for each group. The simplest thing
that could possibly work would be to use one cpu per track. This may not be
ideal in all situations (user could have only one track), but it should work
relatively well for many cases. And it should at least not slow down things
like our current strategy.
We could also use one cpu per voice for more fine grained grouping that
still preserves locality.