Further results cache optimizations to support PowerAnalytics #1079
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Two main things here:
load_results!
was opening a store even if all the requested results were already cached; opening the store is now left to_read_results
after it decides whether it needs to do so.read_results_with_keys
is slowish even if the results are already cached because a lot of data has to be converted to DataFrame. Now there is an optional kwarg to request a certain list of columns and only those will be converted, resulting in much (~1000x on large datasets) less memory usage and much faster call times.The result is that
load_results!
andread_results_with_keys
can be called thousands of times in a tight loop as PowerAnalytics iterates over components and it's not horrendously inefficient (just a few seconds total for large datasets). Leaving as draft in case I identify more small optimizations to add.