Adds reduce methods to a number of Resource monads, which do a "flat" resource reduction. That is, they use ThinResourceMonad.reduce to produce a single resource node, which collects all dependencies and reduces the dynamics, rather than the original Resources.reduce method, which creates a number of intermediate resources linear in the number of operands.
When doing large roll-ups, like a power model, those intermediate nodes each contribute a small performance overhead which can eventually add up. Providing a standard way to do reduction efficiently, and using that to do common operations like taking a sum or maximum, should help.
Verification
Some methods which use the new reduce operations, like PolynomialResources.min and max, already have unit tests. Those tests continue to pass unaltered.
Documentation
No documentation was invalidated - existing functions should have no logical changes, but they may be more efficient.
These reduce operators are mentioned in the streamline users' guide already. I wrote them once before and thought they were part of the main library, but I must have written them on another branch that has since been abandoned.
Description
Adds reduce methods to a number of Resource monads, which do a "flat" resource reduction. That is, they use ThinResourceMonad.reduce to produce a single resource node, which collects all dependencies and reduces the dynamics, rather than the original Resources.reduce method, which creates a number of intermediate resources linear in the number of operands.
When doing large roll-ups, like a power model, those intermediate nodes each contribute a small performance overhead which can eventually add up. Providing a standard way to do reduction efficiently, and using that to do common operations like taking a sum or maximum, should help.
Verification
Some methods which use the new reduce operations, like PolynomialResources.min and max, already have unit tests. Those tests continue to pass unaltered.
Documentation
No documentation was invalidated - existing functions should have no logical changes, but they may be more efficient. These
reduce
operators are mentioned in the streamline users' guide already. I wrote them once before and thought they were part of the main library, but I must have written them on another branch that has since been abandoned.Future work
N/A