Skip to content

Improved caching #44

Open
Open
@vyasr

Description

@vyasr

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions