ElectricityLCI icon indicating copy to clipboard operation
ElectricityLCI copied to clipboard

using joblib memory class to improve performance for duplicate function calls

Open bl-young opened this issue 3 years ago • 2 comments

importing of some modules, particularly those that use stewi data results in objects being stored in memory (example)

Moving those function calls inside functions may result in needing to call the function multiple times.

joblib Memory class, or something similar, could be helpful for caching those function calls to improve performance https://joblib.readthedocs.io/en/latest/memory.html

bl-young avatar Sep 28 '21 18:09 bl-young

You happen to try this at all? Looking at the example, there is a lot that goes on inside that module with almost nothing inside functions. I think the most efficient thing to do in this place is to put everything inside a function and cache that result. I guess I would need to take a closer look to see what variables need to be exposed to the modules calling it.

m-jamieson avatar Jul 15 '22 18:07 m-jamieson

I think I recall when I looked into it a bit that it doesn't work so well for caching results of function calls that are data frames. But it's been a while. Feel free to close this it may not be useful.

bl-young avatar Jul 15 '22 19:07 bl-young