-
Notifications
You must be signed in to change notification settings - Fork 1
Description
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.