Do not format QNames to string on input 76/82276/4
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 28 May 2019 11:14:34 +0000 (13:14 +0200)
committerTom Pantelis <tompantelis@gmail.com>
Wed, 29 May 2019 16:31:53 +0000 (16:31 +0000)
commita69604185f71923bdfc16d2d056490fff9a8d90e
tree38c4f8a91bd62acdb55794d524a723000eaaf53f
parentdc54b87a6b2fb11d233b8294b684268f4d5161de
Do not format QNames to string on input

Profiling has revelead the creation of String for QNameFactory
lookup is taking around 19% of overall cost of
NormalizedNodeInputStreamReader.readQName().

Rather than using concatenation, use a dedicated Key object, which
holds the separated-out localname/namespace/revision strings,
thus allocating a small object instead of a full-blown String.

This improves snapshot deserialization perfomance on a 350MiB
snapshot by about 16%, also resulting in lower memory pressure.

JIRA: CONTROLLER-1897
Change-Id: If3e9e4b332b0a5acbe33aa10fca189bbc7da8c81
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/QNameFactory.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeInputStreamReader.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/QNameFactoryTest.java