[YANGTOOLS-460] Binding DTOs: cache hashcode Created: 09/Jun/15  Updated: 10/Apr/22  Resolved: 11/Jun/15

Status: Resolved
Project: yangtools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement
Reporter: Robert Varga Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

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.



 Comments   
Comment by Robert Varga [ 09/Jun/15 ]

https://git.opendaylight.org/gerrit/22241

Generated at Wed Feb 07 20:53:18 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.