Optimize DataTreeCandidate.applyToModification() 73/19473/5
authorRobert Varga <rovarga@cisco.com>
Sat, 2 May 2015 04:09:52 +0000 (06:09 +0200)
committerRobert Varga <rovarga@cisco.com>
Sun, 3 May 2015 17:13:51 +0000 (19:13 +0200)
commit20552d0e08865d69047f9c794f9ff763434e06b3
tree078b511d26eb9bb02ce14870d56b7538dbcc28bb
parentc30bea17ea3b476ba5748546df13249c41b41879
Optimize DataTreeCandidate.applyToModification()

Both implementations use recursive calls to themselves. Instead of recursion,
we can use a simplistic single-linked stack of operations and iterate over
them.

While this results in object allocation, these objects are short-lived
and never leak from current thread, which means they are easily
collected. Since the call is not recursive, JIT should be able to more
easily inline and optimize the operations.

Change-Id: I7d82a58c6be3e853ea5bcf9069876370804cb199
Signed-off-by: Robert Varga <rovarga@cisco.com>
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataTreeCandidateNodes.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataTreeCandidates.java