> Le 17 nov. 2022 à 19:09, Oleg Nesterov <o...@redhat.com> a écrit : > > On 11/17, Oleg Nesterov wrote: >> >> However, if ffarity() == 0 >> >> a = fconstant(float a, ""); >> b = fconstant(float b, ""); >> >> c = a / b; >> >> f0 = ffunction(float f0(), "",""); >> process = f0 : *(c); >> >> then "a / b" is calculated at run time: >> >> virtual void instanceConstants(int sample_rate) { >> fSampleRate = sample_rate; >> } >> virtual void compute(int count, FAUSTFLOAT** RESTRICT inputs, >> FAUSTFLOAT** RESTRICT outputs) { >> FAUSTFLOAT* output0 = outputs[0]; >> for (int i0 = 0; i0 < count; i0 = i0 + 1) { >> output0[i0] = FAUSTFLOAT(f0() * a / b); >> } >> } >> >> and this looks like performance bug to me. > > OK, I am not sure but it seems that mterm::normalizedTree() is confused by > getSigOrder(f0). The patch below seems to fix the problem. > > What do you think? > > Oleg. > > diff --git a/compiler/signals/sigorderrules.cpp > b/compiler/signals/sigorderrules.cpp > index d30248ccc..4866122e4 100644 > --- a/compiler/signals/sigorderrules.cpp > +++ b/compiler/signals/sigorderrules.cpp > @@ -128,7 +128,7 @@ static int infereSigOrder(Tree sig) > return O(s1); > > else if (isSigFFun(sig, ff, ls) && isNil(ls)) > - return 1; > + return 3; > > else if (isSigFFun(sig, ff, ls)) > return max(1, O(ls)); >
Thanks ! this is a good fix, committed here : https://github.com/grame-cncm/faust/commit/632330c82dc76f5dbb2ed5be3af368424bc082f9 and now correctly the semantic described here: https://faustdoc.grame.fr/manual/syntax/#foreign-function-declaration Stéphane _______________________________________________ Faudiostream-devel mailing list Faudiostream-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-devel