Skip to content

dpd_object: shared cache vs. setattr() #10

@cshimmin

Description

@cshimmin

As detailed in c63ae63, the new DPDObject copy semantics make use of a shared dictionary object to cache TTree lookups. This means less memory and less copying time for (variational) analyses which carry around multiple copies of the object, resulting in a significant speedup over the old copy semantics.

However, this method relies on a try/except dictionary lookup. In cases where the objects are not copied, or the copies are seldom used, this results in a lot of failed exceptions and is slower than the previous setattr() scheme.

In both cases, overriding the __copy__ method (which caused a lot of __getattr__ recursion) is already a considerable speedup!

TODO: research benefits of shared cache vs. setattr cache; and perhaps provide two implementations of DPDObject so the user can choose the appropriate one for each application.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions