Do not instantiate augmentation HashMap in DTO builders 32/21932/2
authorRobert Varga <rovarga@cisco.com>
Tue, 26 May 2015 22:18:57 +0000 (00:18 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 5 Jun 2015 10:44:47 +0000 (10:44 +0000)
commit0bd0dd9f494578956f8d8f6ac4733f1ae9f1ce71
treeb642b1aedce4af2acb89d606dc98a1f702cc460d
parentfe2c484a586350c458a1a9d014896d6aa9e12bb7
Do not instantiate augmentation HashMap in DTO builders

Tracing has revealed that the OpenFlowPlugin creates a lot of builders,
instantiation a million HashMaps, which accounts for 1% of CPU time.
Most of these maps are never touched, so we can easily optimize this
away by lazily instantiating a HashMap when the first augmentation is
added. Also prevents copying of empty augmentation in the copy
constructor.

Change-Id: I592fe6af65c9f3b65038def8bb4069666bfdc375
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 2cb012f4e814859e10726d02cb1c073321316ab3)
code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/BuilderTemplate.xtend