mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-01 07:13:24 +03:00
1851f0802e
improve case conversion happy path Someone shared the source code for [Go's string case conversion](https://github.com/golang/go/blob/19156a54741d4f353c9e8e0860197ca95a6ee6ca/src/strings/strings.go#L558-L616). It features a hot path for ascii-only strings (although I assume for reasons specific to go, they've opted for a read safe hot loop). I've borrowed these ideas and also kept our existing code to provide a fast path + seamless utf-8 correct path fallback. (Naive) Benchmarks can be found here https://github.com/conradludgate/case-conv For the cases where non-ascii is found near the start, the performance of this algorithm does fall back to original speeds and has not had any measurable speed loss