Uploaded image for project: 'OpenFlowPlugin'
  1. OpenFlowPlugin
  2. OPNFLWPLUG-1068

Optimize MatchEntrySerializer

XMLWordPrintable

      MatchEntrySerializer interface has a non-optimal design, as its only use is 'serialize-if-present', which is split into two distinct methods (matchTypeCheck() and serialize()). This leads to implementations not being able to retain information extracted during 'if-present' phase and they have to walk the Match DTOs twice and for cases where information needs to be split out (like Ipv4Prefix), they end up performing the same operations.

      Rework MatchEntrySerializer to have a serializeIfPresent() method, which performs a fused check and serialization, allowing implementations to reuse data they extract from the Match structure.

      The implementation side of things, in org.opendaylight.openflowplugin.impl.protocol.serialization.match, the code structure is heavily impacted by the API design. It also trades code for memory, which does not make sense as the implementation objects each have a single instance. One example is header bytes, which can have at most two values, yet these are computed for each emitted match.

      Furthermore the overall class hierarchy design does not abstract the header/body part too well, nor does it provide any sort of code-sharing, leading to large chunks of duplicated code. Worse yet, execution speed is hampered by each step requiring a megamorphic (i.e. type-specific) invocation, which hurts devirtualization and inlining.

      Rework serializer implementations to cache their headers, share code where possible and perform check-and-serialize retaining enough information between the two phases, so we do not perform duplicate work unless absolutely necessary.

       

            rovarga Robert Varga
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: