proxy.golang.org : github.com/perdata/trope
Package trope implements a simple rope-like datastructure for large immutable collections. Unlike a rope which uses binary trees, trope uses a dynamic branch factor. The data structure is mainly optimized for performance when a large number of edit operations are made. The underlying tree is not automatically rebalanced as most situations can do without this step. A Flatten() method is provided to construct a somewhat balanced tree in an efficient manner but this is not a true balancing. In particular, the number of nodes depends on the number of edits and the root node has unbounded branching factor. But in most practical sitations, this will work fine. The rope datastructure is often too expensive for fairly small arrays. The Hybrid type is defined to get the best of both worlds by using the regular array implementation for small counts and switching to the more complex structure at a configured high water mark. These benchmarks include 100 iterations of random slicing (on top of the previous result). The comparison is between trope.Node, trope.Hybrid and a simple string-slice based splice operation. String size of 5k: String size of 200k: The benchmarks are obviously specific to the hardware but it gives an idea about the relative performance characterestics.
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/perdata/trope
Keywords:
collections
, data-structures
, golang
, immutable
, large
, persistent
License: MIT
Latest release: about 7 years ago
First release: about 7 years ago
Namespace: github.com/perdata
Stars: 2 on GitHub
Forks: 1 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 5 days ago