3 ms·
Didn't know about this data structure. What are some use cases other than text editors? The article on wikipedia [1] doesn't expand much on this. [1] https://e
by ggregoire 2y ago
Didn't know about this data structure. What are some use cases other than text editors? The article on wikipedia [1] doesn't expand much on this.
[1] https://en.wikipedia.org/wiki/Rope_(data_structure) https://en.wikipedia.org/wiki/Rope_(data_structure)
- josephg 2y agoWe use them pretty heavily in realtime collaborative editing libraries for text. Ie, text CRDTs. In diamond types, merging a branch into another branch requires (essentially) replaying a whole lot of edit operations. Using a rope makes that fast.
- zahlman 2y agoI imagine that text template renders could benefit. The general use case is any time you need to repeatedly splice (take slices, insert data in the middle etc) a text of significant length and performance is important. (I heard of this concept a long time ago, but rarely think about it.)