Closed gogins closed 3 years ago
faustgen
opcodes run the same .dsp source code in 87% of the time taken by the same .dsp code compiled to C++ with faust2csound (which compiles with -O3
) as a Csound plugin opcode. But the difference in efficiency is not so large and one wonders if this might vary for different algorithms.By default the C++ compiler compiles for a "generic" CPU, where the LLVM backend is configurated to produce code for the "native" CPU (that one where the code will actually run). This usually explains this kind of differences.
You can try to use -march=native
and also '-Ofast'
in the C++ compiler, to have the same options the LLVM backend is using.
Some general explanations to get the most performances: https://faustdoc.grame.fr/manual/optimizing/#optimizing-the-c-or-llvm-code
OK, this is now more complete and it is also more unequivocal.
It is clear that using Faust to generate C++ code for a Csound plugin opcode, then compiling the generated C++ using clang++ with -march=native -Ofast
, produces the fastest results. This seems to be because clang++ generates faster machine code than g++.
-Ofast
for generic architecture, is probably the best approach.Yes, of course you are right!
I redid my experiment with -march=mative -Ofast, using clang++ instead of g++, and now the native opcode runs in 76% of the time as the "faustgen" opcodes. This is a useful advantage.
Updated details here: https://github.com/gogins/csound-extended/issues/187#issuecomment-914267546
I have no idea why this did not occur to me, as I already am building Csound with -march=native. I will try switching to clang++ for Csound as well.
Thanks, Mike
Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com
On Tue, Sep 7, 2021 at 5:19 AM Stéphane Letz @.***> wrote:
Some general explanations to get the most performances: https://faustdoc.grame.fr/manual/optimizing/#optimizing-the-c-or-llvm-code
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/gogins/csound-extended/issues/187#issuecomment-914139744, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQIGJPKJZLN3ZTRV3PBL7TUAXKLXANCNFSM5DQSJH4Q .
Which runs faster, a Faust DSP algorithm implemented using run-time compilation with Csound's "faustgen" opcodes, or the same algorithm implemented using "faust2csound" as a C++ native plugin opcode?
modularInterpInstrMIDI.dsp
.faust_guitar_test.csd
. This contains both implementions and renders the same MIDI file.