Optimize DataObjectCodecContext memory footprint 72/81872/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 2 May 2019 10:27:58 +0000 (12:27 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 2 May 2019 10:27:58 +0000 (12:27 +0200)
commit09870ca2f1234be7c175667341f783c0b95ef408
tree290e1a7c67e14f2a64ebc87b6007de2b8820c373
parent5b5b2ff989cbc7c074357f55a7b76561a925bbdb
Optimize DataObjectCodecContext memory footprint

Examining heap dumps while working on MDSAL-442/MDSAL-443 revealed
a slight inefficiency in DataObjectCodecContext: we are forcing
byStreamClass's entrySet to be instantiated for the purposes of
copying it into byBindingArgClassBuilder.

This patch corrects the mistake by using byStreamClassBuilder
as the source of copied entries -- which holds the same content,
but we will be throwing it away.

Furthermore byStreamClass and byBindingArgClass are only distinct
when we have a choice child, hence we also run comparison on the
two builders and reuse byStreamClass if they are equal.

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