Add performance fixmes 60/21760/1
authorRobert Varga <rovarga@cisco.com>
Wed, 3 Jun 2015 12:57:29 +0000 (14:57 +0200)
committerRobert Varga <rovarga@cisco.com>
Wed, 3 Jun 2015 12:59:36 +0000 (14:59 +0200)
We could do with a cache in two strategic places, mark them.

Change-Id: I20a9e98d85740107413afad54b391d1bda990672
Signed-off-by: Robert Varga <rovarga@cisco.com>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/AbstractIPRIBSupport.java

index 99a97d1892f7c4b4aa56530fee682c496c3ad8c6..47604443e2f26e340054099fff7aafea3e1405c3 100644 (file)
@@ -126,6 +126,7 @@ abstract class AbstractIPRIBSupport extends AbstractRIBSupport {
                 final DataContainerChild<? extends PathArgument, ?> routes = maybeRoutes.get();
                 if (routes instanceof UnkeyedListNode) {
                     // Instance identifier to table/(choice routes)/(map of route)
+                    // FIXME: cache on per-table basis (in TableContext, for example)
                     final YangInstanceIdentifier base = tablePath.node(ROUTES).node(routesContainerIdentifier()).node(routeIdentifier());
                     for (final UnkeyedListEntryNode e : ((UnkeyedListNode)routes).getValue()) {
                         final NodeIdentifierWithPredicates routeKey = createRouteKey(e);
@@ -141,6 +142,9 @@ abstract class AbstractIPRIBSupport extends AbstractRIBSupport {
     private NodeIdentifierWithPredicates createRouteKey(final UnkeyedListEntryNode e) {
         final Optional<DataContainerChild<? extends PathArgument, ?>> maybeKeyLeaf = e.getChild(routeKeyLeafIdentifier());
         Preconditions.checkState(maybeKeyLeaf.isPresent());
+
+        // FIXME: a cache here would mean we instantiate the same identifier for each route
+        //        making comparison quicker.
         final Object keyValue = ((LeafNode<?>) maybeKeyLeaf.get()).getValue();
         return new NodeIdentifierWithPredicates(routeQName(), keyLeafQName(), keyValue);
     }