You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: kotlinx-collections-immutable/src/main/kotlin/kotlinx/collections/immutable/implementations/immutableSet/TrieNode.kt
+28-12Lines changed: 28 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -102,19 +102,36 @@ internal class TrieNode<E>(
102
102
// assert(buffer[nodeIndex] !== newNode)
103
103
104
104
val newBuffer = buffer.copyOf()
105
-
newBuffer[nodeIndex] = newNode
105
+
106
+
// TODO: check how this changes affect `add` operation performance.
107
+
// Try to not create this newNode, but pass here the remained element.
108
+
val newNodeBuffer = newNode.buffer
109
+
if (newNodeBuffer.size ==1&& newNodeBuffer[0] !isTrieNode<*>) {
0 commit comments