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
From the documentation, it sounds like the dtrie is intended to be an immutable, hash array mapped trie implementation:
Dtrie
A persistent hash trie that dynamically expands or shrinks to provide efficient memory allocation. Being persistent, the Dtrie is immutable and any modification yields a new version of the Dtrie rather than changing the original. Bitmapped nodes allow for O(log32(n)) get, remove, and update operations. Insertions are O(n) and iteration is O(1).
However, this doesn't appear true:
t0:=dtrie.New(nil)
t1:=t0.Insert("a", "b")
t2:=t1.Insert("c", "d")
fmt.Println("trie sizes", t0.Size(), t1.Size(), t2.Size()) // yields 2, 2, 2; should be 0, 1, 2fmt.Println(t0.Get("c")) // "d"; should be nilfmt.Println(t1.Get("c")) // "d"; should be nilfmt.Println(t2.Get("c")) // "d"; which is correct
It's also pretty easy to trigger a panic with concurrent access. This will reliably result in a panic on my machine -
Now, I know that this project hasn't seen a ton of updates in the past couple of years, and I'd understand if no-one wants to dig in to fix it properly. Nonetheless, I feel like a limitation like this would at least be worth documenting if it's not going to be fixed. I'd be happy to make a PR to that effect.
The text was updated successfully, but these errors were encountered:
Tested on v1.0.50:
From the documentation, it sounds like the dtrie is intended to be an immutable, hash array mapped trie implementation:
However, this doesn't appear true:
It's also pretty easy to trigger a panic with concurrent access. This will reliably result in a panic on my machine -
Now, I know that this project hasn't seen a ton of updates in the past couple of years, and I'd understand if no-one wants to dig in to fix it properly. Nonetheless, I feel like a limitation like this would at least be worth documenting if it's not going to be fixed. I'd be happy to make a PR to that effect.
The text was updated successfully, but these errors were encountered: