Optimize BindingNormalizedNodeCodecRegistry representation checks 06/83706/4
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 16 Aug 2019 13:40:24 +0000 (15:40 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 28 Aug 2019 00:26:47 +0000 (00:26 +0000)
commitb709b2023561c45d4e0b095e06a45b60ed3d2087
treebb48892aea4c22e809dde46b0d67da8049118629
parent343faadde95ae5343bc166e4bc12877fdeb42375
Optimize BindingNormalizedNodeCodecRegistry representation checks

isBindingRepresentable() is a hot method, which performs a few
type checks. This patch folds those checks into a single return,
inverting the logic (which is negated anyway at the sole caller).
This cuts the amount of byte code to half, thus aiding inlining.

Futhermore we take advantage of ValueNode covering two cases we
explicitly test for, reducing the number of checks performed.

Finally we reorder the checks to improve their efficiency by
tackling most-common constructs first.

Change-Id: I556d1098a9d7dd043b2f8d756c2388f339f6b8ec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/BindingNormalizedNodeCodecRegistry.java