Skip to content

try caching generated functions and/or implementation #89

Description

@sixpearls

At some point we switched from persistent implementation instances for models to creating new ones per-call of a model to (1) ensure options could be updated and (2) provide better support for multiprocessing since some casadi objects that were stored in the implementation are not pickleable. One downside is that code-generated functions ("callables", i.e., expressions from model fields) must be re-generated; even worse for symbolic manipulations before code generation. Previously, implementation instances held all callables that a model would need. Now that we cannot assume the implementation instance has been created when the model is built, some models build callables in random places.

#88 uses caching for an optional callable. This approach could be used generally for generated callables (again, especially with symbolic manipulation), perhaps as methods on the meta class for each model. This approach might usable for implementation instances themselves, but we would need to make sure options could be updated as needed. Ideally we can identify a pattern that can be used to standardize the location for creating model callables and improve performance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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