Is the set fixed? Are the same expressions evaluated multiple times? What I’m after is: will it help if I explain to you how to get function pointers from the expression, that you then re-use and invoke (at 0 cost) from there on? That’s not useful if each expression is only ever evaluated once.
Hi Axel,
yes the set of expressions is fixed and constructed when program starts. Each expression is evaluated for each incoming event. Please explain how to get function pointers in order to re-use them ad each invocation.
Hi thanks for your support,
your solution works as expected, but there is a problem if the code will be executed again (as example when I stop and start my DAQ) because the functions are redefined and interpreter returns errors…
I solved the problem with gROOT->ProcessLine instead of gInterpreter->Declare but I don’t know if the invocation speed is the same… I also proceed with funcPtr mechanism and it works fine !
Good! gROOT->ProcessLine() is a bit slower because it includes “user-code protection”, such as if there’s a nullptr dereference, the call won’t crash but an exception is thrown instead. The alternative is to have a counter on the function name and increment that on a re-start of the DAQ.