This library currently has no PR testing for Wasm, even though it's a dependency of other libraries that declare Wasm support. To prevent possible future regressions, let's add Wasm build checks to the CI workflows.
rdar://135961596
When removing elements from a B-tree, the root node could become empty while still having children. The previous code incorrectly called drop() which deallocated all children, causing massive data loss during removal operations.
This fix implements proper root reduction by moving the single remaining child out of the empty root, then safely dropping the now-empty parent node and promoting the extracted child to become the new root.
This fixes `test_modifySubscriptRemoval` in `SortedDictionaryTests`, so we re-enable SortedDictionary tests which now all pass.
`findAnyIndex(forKey:)` miscomputed the global offset when a key was found in an internal B-tree node, due to missing child subtree counts in the calculation.
This implements a roughly 40-45% improvement for distance measurements over `BigString`’s character and Unicode Scalar views.
Interestingly, we don’t see an improvement for UTF-16 views — I’m guessing this is due to String’s breadcrumbing. (And it will go away with the upcoming UTF8Span-ification of this type.)
The benchmarks I added only show an improvement for multi-chunk big string instances, but this is merely an artifact of the specific algorithm that is being measured — for single-chunk strings, the existing measurement method is already optimal, so the new heuristic never triggers for this particular payload.
BigString sometimes miscounted distances in its character view due to alignment issues. Resolve this by overhauling distance calculations in the character metric:
- Introduce a `prefixSize` function in `_StringMetric`, distinct from `distance`.
- In the metric-agnostic index distance algorithm, use `prefixCount` to avoid double-counting characters that cross (or end on) chunk boundaries.
- Simplify `_StringMetric.distance` by requiring that `start <= end`.
- Crucially, change character-index operations to start by rounding each input index down to the nearest character break.
It looks like something was merged in a funny way resulting in the
platform info module being included twice in the top-level CMakeLists
files. Removing one of them.
The sorted collection types are not yet ready for production use. Remove them from the package manifest.
Keep the code in place for now, although it will likely make more sense to track their development in a separate feature branch of this package.