On Thu, Dec 1, 2011 at 10:09 AM, Mathieu Bouchard <ma...@artengine.ca> wrote: > Le 2011-12-01 à 15:24:00, Roman Haefeli a écrit : > > >> reason, let's just use an invented arbitrary unit for expressing the CPU >> time (ct) consumed by an object. It turned out that [gate~] uses 0.52ct >> when it is on and 0.4ct when it is off. But how much does [*~ ] use? No >> matter whether turned on or off, [*~ ] uses a stable 0.39ct. > > > Even though [switch~] does not use tight conditionals, instead checking only > once per block, it still takes some time copying stuff and switching > contexts. I suppose that this is the kind of thing that Pd could do more > efficiently than it does now, if someone is brave enough to edit d_ugen.c... > and knows how to do it.
For further explanation: In an abstraction where the block sizes match and there's no switch~, signals are borrowed from the parent context. When switch~ is used, inlet~ and outlet~ signals are not borrowed, even when block sizes match. block_prolog handles the switch~ behavior, returning a pointer to the end of the block epilog when switched off. This comes before data is copied into buffers in inlet_doprolog. On the outlet~, there is an un-borrowed signal allocated, and I think it's also assigned to be zero when switched off. This would be the only major point where an assignment operation occurs. When using [*~ 0], the inlet and outlet are borrowed. The scalar multiply operation is performed in place and no data transfer occurs. It's all relatively fresh in my mind, but I need a good week's vacation to re-focus and study d_ugen.c some more. I've done enough to understand what's in there, but I've rarely asked the question how to make it work better. _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list