Closed milseman closed 1 year ago
Note: the times are post https://github.com/apple/swift-experimental-string-processing/pull/642
Switching coding convention/style to inline the quick-check and outline the slow path, along with recognizing the yes/no/maybe nature of quick checks, gives us further benefits. Added assertions (to check behavior parity) and added the first entry in the programmer's manual.
This change resulted in a robust improvement in EmailBuiltinCharacterClassAll (10% more shrinkage consistent across many runs), while other benchmarks were largely unaffected.
New overall results:
=== Regressions ======================================================================
- EmailRFCNoMatchesAll 140ms 133ms 6.75ms 5.1%
- EmailRFCAll 64.4ms 61.9ms 2.52ms 4.1%
- EmojiRegexAll 73.7ms 71.2ms 2.47ms 3.5%
- symDiffCCC 49.9ms 48.6ms 1.31ms 2.7%
- EmailLookaheadNoMatchesAll 41.7ms 40.4ms 1.3ms 3.2%
- EmailLookaheadAll 40.7ms 39.5ms 1.16ms 2.9%
- InvertedCCC 21.8ms 20.9ms 929µs 4.5%
- BasicRangeCCC 11.4ms 11ms 373µs 3.4%
- ReluctantQuantWithTerminalWhole 9.42ms 9.09ms 333µs 3.7%
- BasicCCC 11ms 10.6ms 330µs 3.1%
- EmailLookaheadList 10ms 9.72ms 316µs 3.3%
- ReluctantQuantWhole 14.2ms 13.8ms 305µs 2.2%
- CaseInsensitiveCCC 12.1ms 11.9ms 223µs 1.9%
- AnchoredNotFoundWhole 9.17ms 8.97ms 200µs 2.2%
- LiteralSearchAll 6.78ms 6.58ms 199µs 3.0%
- IntersectionCCC 22.3ms 22.1ms 195µs 0.9%
- SubtractionCCC 21.8ms 21.6ms 189µs 0.9%
- NotFoundAll 7.22ms 7.03ms 188µs 2.7%
- LiteralSearchNotFoundAll 6.56ms 6.4ms 156µs 2.4%
- IPv6Address 4.14ms 3.98ms 151µs 3.8%
- HangulSyllableAll 6.99ms 6.85ms 138µs 2.0%
- MACAddress 3.07ms 2.96ms 106µs 3.6%
- EagarQuantWithTerminalWhole 2.67ms 2.56ms 104µs 4.1%
- LinesAll 3.19ms 3.12ms 77.1µs 2.5%
- HangulSyllableFirst 3.36ms 3.3ms 64µs 1.9%
=== Improvements =====================================================================
- DiceRollsInTextAll 48.2ms 62.2ms -14ms -22.6%
- EmailBuiltinCharacterClassAll 13ms 24.6ms -11.6ms -47.0%
- WordsAll 14.2ms 21.7ms -7.47ms -34.5%
- BasicBuiltinCharacterClassAll 8.73ms 14.6ms -5.87ms -40.2%
- NumbersAll 7.67ms 11.5ms -3.85ms -33.4%
- DiceNotation 5.21ms 6.73ms -1.52ms -22.6%
- GraphemeBreakNoCapAll 5.35ms 6.75ms -1.4ms -20.7%
- CompilerMessagesAll 117ms 119ms -1.37ms -1.2%
- IPv4Address 2.52ms 2.76ms -238µs -8.6%
- CssAll 3.82ms 3.94ms -120µs -3.0%
Converting to draft as I still have a little more refactoring to do
@swift-ci please test
@swift-ci please test
I made an ASCII.swift
file in the Unicode
folder, and also put some of the quick checks on String
directly so we could avoid @_effects(releasenone)
.
@swift-ci please test
When the portion of the string being matched is ASCII, use fast ASCII character class membership tests.