Speed up GenEvent::attribute_names
Profiling indicated GenEvent::attribute_names was taking ~85% of runtime when reading a HepMC2 ASCII file. Replacing a linear-time search with a log-time search speeds up the function 150x in my tests.
Merge request reports
Activity
added 1 commit
- 19a6bbbd - Linear -> log search time for GenEvent::attribute_names
mentioned in commit 970c64f6
Hi Andrii,
For my test I read a fairly generic W -> mu nu HepMC2 file (just calling read_event). I profiled it with VTune (using the standard CERN CVMFS installation) and just looked at what the leading functions for time use were. After this patch, it seems the largest single CPU user for ReaderAsciiHepMC2 is all the atof calls, which I guess are unavoidable.
Best, Peter
Hi Peter,
Ok, I see. Thanks a lot for the information. We are using a combination of atof and strchr, so one could replace that with strtof or so. I've looked there some time ago, but the improvements were minuscule as atof was not the leading function. Maybe after your fix this will change.
Best regards, Andrii