Do not instantiate augmentation HashMap in DTO builders
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)
commitef42c9c7bff5a4e62ceb3e792a35c24ff2e1294b
treed772a3227e6965489773438d336e5ee6dc1bc3f6
parentb9e0a086e2a6aaed5e615eff0e5fe74f94c40aeb
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