Note that your examples does the actual computation once per block. To test the
CPU, its better to have lut1/lut2 runs each sample, using something like:
process = _ <: (lut1 : hbargraph("B", 1, 5)) (lut2 : hbargraph("C", 1, 5));
Assuming you have installed faust locally, you can then use faustbench of
faustbench-lvm tools to measure CPU usage, see:
https://github.com/grame-cncm/faust/tree/master-dev/tools/benchmark#faustbench
https://github.com/grame-cncm/faust/tree/master-dev/tools/benchmark#faustbench-llvm
Stéphane
> Le 13 janv. 2022 à 19:05, Jean-Louis Paquelin <[email protected]> a
> écrit :
>
> @James and @bart, thank you for your quick reply.
>
> So (if I understand you well) pattern matching should be thought of as a
> static rewriting tool.
> And, btw, you're right
> process = 2 : lut : hbargraph("B", 1, 5);
> sets the bargraph to 2, while
> process = lut(2) : hbargraph("B", 1, 5);
> sets it to 3 (as expected).
>
> I came with 2 ways to write the lut() function I need:
>
> lut1(n) = 1,3,4,2,5 : ba.selectn(5, n - 1);
> lut2(n) = ((n == 1) | (n == 5)) * n + (n == 2) * 3 + (n == 3) * 4 + (n == 4)
> * 2;
> process = hslider("A", 1, 1, 5, 1) <: (lut1 : hbargraph("B", 1, 5)), (lut2 :
> hbargraph("C", 1, 5));
>
> Both functions seem to provide the service I'm asking for. But the first one
> is more readable than the second.
> Any idea which one is the lightest for the CPU?
>
> Thanks again,
>
> jlp
_______________________________________________
Faudiostream-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users