TupleOp optimisation
It does not look like performance of the python part is an issue yet, but writing down a list of ideas in case:
- override
__eq__
only inTupleOp
, asid(self) == id(other) or ( isinstance(other, self.__class__) and self.equals(other) )
, whereequals
is overridden in specific classes and does the full value-based comparison it does now -
deepcopy
for changing systematics is a bit too much (many ops/proxies can't be changed, so don't need copying by default), but redefining__deepcopy__
in more places is risky, so making aclone
method may help. - cache
__hash__
result (it is used to keep track of 'defined' objects, and current implementationhash(self.__repr__)
is not cheap) - needs special care to propagate up when doing modifications, though (could pass a subnode-'modifier' function toclone
, that signals a change, such that they are recalculated)