From 5e7e588f9f103524252a945637e97fc173bf201e Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 3 Jun 2015 14:46:18 +0200 Subject: [PATCH] Reuse child NodeIdentifier We effectively create two YangInstanceIdentifiers for the same thing, except for routes we end up creating a different instance of NodeIdentifier, which forces a slower comparison. Reuse the same identifier, lowring memory pressure and increasing performance slightly. Change-Id: I80e8ffa89737476040727f45a8b90bd157527955 Signed-off-by: Robert Varga (cherry picked from commit 6416127e56a0fc0f2645823e082a4eaa39142a28) --- .../protocol/bgp/rib/impl/EffectiveRibInWriter.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/EffectiveRibInWriter.java b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/EffectiveRibInWriter.java index 85b44407f9..4781768446 100644 --- a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/EffectiveRibInWriter.java +++ b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/EffectiveRibInWriter.java @@ -144,14 +144,14 @@ final class EffectiveRibInWriter implements AutoCloseable { break; case SUBTREE_MODIFIED: case WRITE: - tx.put(LogicalDatastoreType.OPERATIONAL, tablePath.node(child.getIdentifier()), child.getDataAfter().get()); + final YangInstanceIdentifier childPath = tablePath.node(child.getIdentifier()); + tx.put(LogicalDatastoreType.OPERATIONAL, childPath, child.getDataAfter().get()); // Routes are special, as they may end up being filtered. The previous put conveniently // ensured that we have them in at target, so a subsequent delete will not fail :) if (TABLE_ROUTES.equals(child.getIdentifier())) { - final YangInstanceIdentifier routesPath = tablePath.node(Routes.QNAME); for (final DataTreeCandidateNode route : ribSupport.changedRoutes(child)) { - processRoute(tx, ribSupport, policy, routesPath, route); + processRoute(tx, ribSupport, policy, childPath, route); } } break; -- 2.36.6