Details
-
Improvement
-
Status: Resolved
-
Resolution: Done
-
None
-
None
-
None
-
None
-
Operating System: All
Platform: All
Description
An interesting case of DTO usage exists in the BGP implementation. Here we maintain a recursive cache of DataObject->NormalizedNode in an attempt to promote object reuse.
As it stands we can end up looking up the same DTO multiple times, which can lead to potentially-lengthy and redundant hashCode() computation, as we may have stored the hash code when the container DTO's hashcode was being computed.
Improve the situation by caching the hash code in an internal field, such that we reuse it if need be. This should be fine, as the DTOs dictate the Immutable contract, so the hash code should not move either.