I changed the minNodeSize formula to match with the B-tree definition, but I failed to match the insertion logic, so it left trees with undersized nodes. D’oh!
Oops, `_BString.subscript(character:)` failed to round down to a character boundary before trying to access the addressed character. It also resolved the index with `preferEnd` set to true, which isn’t what we actually want.
- The original code accidentally used `start` instead of `end` to normalize the end of the range, so it did not actually hash any actual string contents.
- While we’re here, extract the task of iterating over substring chunks into a reusable standalone method.
Having all core functionality exposed by the top-level type is not a bad idea; unfortunately substrings are tricky to get right, so it’s better to implement that out of the box.
This is more of a technical workaround, as it allows
running generic algorithms on these things. That said,
we could embrace this in general, and sink the
`utf8Index(after:)`, `characterIndex(before:)` etc
function down into these views, instead of having them
on the top level.
- New methods for rounding up indices
- Sendable conformances
- Fix UTF-16 strings sometimes leaking into chunks
- Iterator improvements / rewrites, incl. a chunked UTF-8
buffer iterator.
- Support for comparing and hashing UTF-8 slices.
This leaves 56 bits for path data, which should still be plenty.
(We want to allow big strings to grow to 2^48 UTF-8 code units, to
match the standard String; however, there is no practical need to
support any more, and even that is a stretch.)
Add tests to verify that the tree capacity matches expectations
in Release builds. (In Debug builds, we limit the maximum node size,
which drastically reduces capacity. This is okay.)