Hi Yann,

On 05/27, Yann Orlarey wrote:
>
> Since it is a typical "reduce"
> operation, I suggest having "reduce" in the name.

Agreed!

> We can imagine having
> three different versions depending if we start the reduction from the top
> outputs, the bottom outputs, or in parallel.

Agreed,

> // parallel reduce: starts reductions in parallel on both halves
> parReduce(op,1) = si.bus(outputs(op));
> parReduce(op,2) = op;
> parReduce(op,n) = parReduce(op,int(n/2)), parReduce(op,n-int(n/2)) : op;

Yann, sorry for the spam, I am sure this is obvious to you, but let me
comment this change anyway. Lets ignore the fact that this assumes that
inputs(op) == outputs(op) * 2.

IMHO this change makes sense anyway, even if inputs == 2 and outputs == 1,
at least for "n-ary" functions like max/min/etc. Simply because this is
more compiler-friendly.

I mean... I don't know how to explain this in English, so let me provide
2 trivial examples,

test1.dsp:

        // this is what we currently have
        parallelOp(op,1) = _;
        parallelOp(op,2) = op;
        parallelOp(op,n) = op(parallelOp(op,n-1));

        process = parallelOp(max,1024);

test2.dsp:

        // this is what you suggest
        parallelOp(op,1) = _;
        parallelOp(op,2) = op;
        parallelOp(op,n) = parallelOp(op,int(n/2)), parallelOp(op,n-int(n/2)) : 
op;

        process = parallelOp(max,1024);

Now, on my laptop,

        $ time faust -o /dev/null -t 1000000 /tmp/test1.dsp

        real    3m20.498s
        user    3m20.433s
        sys     0m0.167s

        $ time faust -o /dev/null -t 1000000 /tmp/test2.dsp

        real    0m0.128s
        user    0m0.117s
        sys     0m0.010s

as you can see there is a difference ;)

Oleg.



_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to