Functor JIT compilation times scale horrifically
Triggered by @gligorov's comment to perform an early benchmark of !2683 (merged) I was trying to see if I can see any early signs when chaining many functors.
However, I wasn't able to do that because cling never finished compiling my functor
So I created a simple reproducer completely disconnected from my changes and reproducible in our current stack with the below snippet. Feel free to run it yourself, but I've included my observed timings in the comment in the python file.
I'm really quite worried to see this scaling behavior
The proposal in !2683 (merged) would change to a paradigm where bigger functor expressions are build out of many small ones...
IMHO, this scaling behavior would however be a bit of a blocker for that.
I did a quick and superficial look at the line configs and see a lot of selections currently using something in the order of up to 8ish functors, which probably explains why we haven't been hit too hard by this.
Making this issue for a technical discussion, but I think that it definitely is important input for DPA, as previously warned about by @sstahl here lhcb-dpa/project#170
cc: @graven @nnolte @sstahl @mvesteri @poluekt @pkoppenb @erodrigu
from Gaudi.Configuration import ApplicationMgr
from Configurables import (FunctorExampleAlg_int,
Gaudi__Examples__IntDataProducer as IDP)
from Functors import Ex_TimesTwo
app = ApplicationMgr(OutputLevel=VERBOSE)
f_exp = Ex_TimesTwo
# value in range(x) ~ observed time in seconds when doing "time ./Rec/run gaudirun.py test.py"
# 1 ~ 10
# 2 ~ 10
# 3 ~ 10
# 4 ~ 10
# 5 ~ 10
# 6 ~ 11
# 7 ~ 18
# 8 ~ 25
# 9 ~ 42
# 10 ~ 74
# 11 ~ 140
# 12 ~ 265
# 13 ~ 510
for i in range(12):
f_exp += Ex_TimesTwo
f_exp = f_exp > 5
app.TopAlg = [
# needed as input for the next algorithm
IDP(OutputLocation="SomeInt", Value=5),
FunctorExampleAlg_int("FEA1", Cut=f_exp, Input0="SomeInt"),
]
app.EvtMax = 1
app.EvtSel = "NONE"
app.HistogramPersistency = "NONE"