memcpy() in beast profiling



   Hi!

During my attempts to make SpectMorph fast, I've used oprofile to determine the
CPU usage during playback of a small song. It turned out that a significant
part of the CPU usage was caused by memcpy().

To determine if it was BEAST or SpectMorph causing this, I removed the
SpectMorph plugin and replaced it with a BEAST oscillator, so that my
instrument consisted of one ADSR envelope one StandardOsc, and one Amplifier.

The amount of memcpy() during playing the song with that beast-only instrument
was 17.17%. So BEAST spends a lot of time in memcpy(). More analysis revealed
that this is the cost of virtualization, as BEAST does it:

Function master_process_locked_node, in bseenginemaster.c:

      /* catch obuffer pointer changes */
      for (i = 0; i < ENGINE_NODE_N_OSTREAMS (node); i++)
        {
          /* FIXME: this takes the worst possible performance hit to support obuffer pointer virtualization */
          if (node->module.ostreams[i].connected &&
              node->module.ostreams[i].values != node->outputs[i].buffer + diff)
            bse_block_copy_float (new_counter - node->counter, node->outputs[i].buffer + diff, node->module.ostreams[i].values);
        }

Since it already has a FIXME, this is probably old news, but I thought it might
be intersting to have a number how much CPU time this FIXME really costs (although
this will of course vary depending on what one actually does with BEAST).

   Cu... Stefan
-- 
Stefan Westerfeld, Hamburg/Germany, http://space.twc.de/~stefan


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]