turbo
4fe96c47 - Various Rope updates and fixes (#3629)

Commit
2 years ago
Various Rope updates and fixes (#3629) Updates and fixes a few items: - Fix: Prevents a Rope from containing an empty `Bytes` section - Perf: Use a `Box<[RopeElem]>` instead of a `Vec<RopeElem>`, reducing memory useage - Perf: Implement fast path for `Rope::to_str()` when containing a single `Shared` element The first one is the important change. The assumption while iterating (for streaming, equality checks, etc) is that the only time we can hit an empty `Bytes` section is when we reach the end of the entire Rope. If an empty section is hit in the middle of a rope, we can't tell if we've reached the end or we're in the middle without calling N more times (eg, what if an empty section followed an empty section, then we'd need to call 2 more times to see). --------- Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
Parents
Loading