Bind CodecDataObject string instances 77/81877/2
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 2 May 2019 14:13:33 +0000 (16:13 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 2 May 2019 16:20:25 +0000 (18:20 +0200)
commit5a3a3c14a8c75635b0eed9c7189b13741dffa82a
tree37265cf9ea00f04ccd5fadb47813e002b85d742a
parent97adfd595ac4812dc2a612a1bf56af4952e17e4d
Bind CodecDataObject string instances

Heap analysis of the classes we generated on top of CodecDataObject
indicates we have an unnecessarily-large class constant pool. This
boils down our usage of string constants we pass back to
CodecDataObject -- which are coming from QName, but are not guaranteed
to be interned.

Aside from increasing heap consumption, this has a downside of not
requiring deep string comparisons during lookup -- which we want to
avoid if at all possible.

This patch updates generation strategy to create explicit constant
fields, which are bound to direct references to Strings used in
QNames -- resulting in the same objects being used.

JIRA: MDSAL-442
Change-Id: I10ef4ae49525d3f45076260e9438863b5830cf9a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/ClassGeneratorBridge.java [new file with mode: 0644]
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/CodecDataObjectBridge.java [deleted file]
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/CodecDataObjectGenerator.java