This even simpler code :
foo(x) = 5;
process = (foo ~ _) ;
Produces suboptimal code:
virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs)
{
FAUSTFLOAT* output0 = outputs[0];
for (int i = 0; (i < count); i = (i + 1)) {
int iRec0 = 5;
output0[i] = FAUSTFLOAT(iRec0);
}
}
Stéphane
> Le 20 juil. 2018 à 13:08, Kjetil Matheussen <[email protected]> a
> écrit :
>
>
> On Fri, Jul 20, 2018 at 11:35 AM, Kjetil Matheussen
> <[email protected]> wrote:
>
> Actually, Faust should have been able to convert
> m_a1/m_a2/m_a3/m_m0/m_m1/m_m2 into
> slow variables so that we would have avoided all the conditional code in the
> inner loop.
> I'll see if I can come up with a smaller example.
>
>
> I simplified the problem down to this faust program:
>
> """
> modeSlider = hslider ( "Mode" , 0 , 0 , 1 , 1 ) ;
>
> returnfunc(a) = select2(a==0, 2, 3);
>
> process(x) = (function__1936 ~ (_)) : returnfunc with{
> function__1936(a) = modeSlider;
> };
> """
>
> which compiles down to this C++ code:
>
> """
> virtual void compute (int count, FAUSTFLOAT** input, FAUSTFLOAT**
> output) {
> FAUSTFLOAT* input0 = input[0];
> FAUSTFLOAT* output0 = output[0];
> for (int i=0; i<count; i++) {
> float fRec0 = float(fslider0);
> output0[i] = (FAUSTFLOAT)((int((fRec0 == 0)))?3:2);
> }
> }
> }
> """
>
> which would have been faster if "fRec0" and "(FAUSTFLOAT)((int((fRec0 ==
> 0)))?3:2);"
> had been compiled down to slow variables.
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org!
> http://sdm.link/slashdot_______________________________________________
> Faudiostream-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/faudiostream-devel
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Faudiostream-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users