Open pelson opened 1 month ago
@ocefpaf highlighted some performance issues in https://github.com/ioos/compliance-checker/pull/1118#issuecomment-2462095271. I don't really think the magnitude there is representative of the performance of pyudunuts2
(given the entire test suite of pyudunits2 runs in <2s), but it would be good to both get the aforementioned metrics, and to track down where the performance penalties are coming from in the checker (and whether these are a result of some of the workarounds due to missing pyudunits2 features)
I'm pretty sure we do things in the least optimized way possible in compliance-checker, so please take those number with a grain of salt. Yet, when using cf-units, the tests run super fast. I'll try to debug this further to figure out where the hiccups are.
A quick glance suggests that the generated converter from pyudunits2 (which uses
sympy
lambdify
) is significantly quicker than the one that is generated byudunits2
(used withincf-units
). However, this performance doesn't shine until you have a lot of data to convert (e.g.5000*2500*12
data points). Before that, the cost of reading the XML, parsing, etc. is much higher inpyudunits2
. It would be good to micro-benchmark this so that we can focus on speeding things up at pinch points.I had the following scripted hacked together to roughly compare:
With results along the lines of: