Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved caching #44

Open
vyasr opened this issue Jan 19, 2020 · 0 comments
Open

Improved caching #44

vyasr opened this issue Jan 19, 2020 · 0 comments

Comments

@vyasr
Copy link
Contributor

vyasr commented Jan 19, 2020

Feature description

Right now all properties are computed every time they are called. We should implement a caching mechanism by which the computed values are stored the first time they are computed.

Proposed solution

We should implement a decorator, e.g. cached_property, that stores computed properties into a global dict cache if they are not found in the cache. We should also implement a second decorator invalidates_cached_properties(property_names) that removes data from the cache whenever a function is run that invalidates some property (e.g. rescaling the area of a polygon invalidates the moment of inertia calculation).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant