Repository navigation
[JSC] Skip identical printable ASCII prefix in Intl.Collator ASCII fast path - #77424
Merged
Merged
Conversation
Collaborator
|
EWS run on current version of this PR (hash 6fd5672) Details
|
sosukesuzuki
approved these changes
Oct 19, 2026
…st path https://bugs.webkit.org/show_bug.cgi?id=327979 rdar://190333228 Reviewed by Sosuke Suzuki. compareASCIIWithUCADUCET first scanned equal-length strings with equal() and then walked the same characters again comparing DUCET weights. For 8-bit strings, this patch merges both into a single pass. The identical prefix is skipped 16 bytes at a time with SIMD while every byte is printable ASCII (0x20-0x7E), since all of those have non-zero DUCET level-1 weight and an identical run of them cannot decide the comparison. The per-character comparison resumes from the first byte that differs or needs checking. The final overlapping 16-byte load avoids a per-character tail. 8-15 byte strings use two overlapping 64-bit loads instead. The level-3 tie-break pass also starts from the first difference instead of position 0, since the identical prefix has identical level-3 weights. Benchmark results with --useJIT=0 are following. ToT Patched intl-collator-compare-long-prefix-different-length 125.0767+-1.0766 ^ 83.3447+-0.4762 ^ definitely 1.5007x faster intl-collator-compare-equal-long 85.4302+-1.0364 ^ 83.0366+-0.7213 ^ definitely 1.0288x faster intl-collator-compare-16bit-long-prefix-primary-diff 151.4125+-0.8296 ^ 121.6623+-1.5823 ^ definitely 1.2445x faster intl-collator-compare-long-prefix-case-diff 174.4286+-0.9481 ^ 85.0297+-0.4806 ^ definitely 2.0514x faster intl-collator-compare-long-prefix-primary-diff 129.0799+-0.9748 ^ 83.8850+-0.5827 ^ definitely 1.5388x faster intl-collator-compare-first-char-diff 83.3505+-0.9395 ^ 81.5479+-0.5391 ^ definitely 1.0221x faster intl-collator-compare-sort-short-keys 164.9051+-2.5775 ^ 144.1785+-0.4210 ^ definitely 1.1438x faster Tests: JSTests/microbenchmarks/intl-collator-compare-16bit-long-prefix-primary-diff.js JSTests/microbenchmarks/intl-collator-compare-equal-long.js JSTests/microbenchmarks/intl-collator-compare-first-char-diff.js JSTests/microbenchmarks/intl-collator-compare-long-prefix-case-diff.js JSTests/microbenchmarks/intl-collator-compare-long-prefix-different-length.js JSTests/microbenchmarks/intl-collator-compare-long-prefix-primary-diff.js JSTests/microbenchmarks/intl-collator-compare-sort-short-keys.js * JSTests/microbenchmarks/intl-collator-compare-16bit-long-prefix-primary-diff.js: Added. (test): * JSTests/microbenchmarks/intl-collator-compare-equal-long.js: Added. (test): * JSTests/microbenchmarks/intl-collator-compare-first-char-diff.js: Added. (test): * JSTests/microbenchmarks/intl-collator-compare-long-prefix-case-diff.js: Added. (test): * JSTests/microbenchmarks/intl-collator-compare-long-prefix-different-length.js: Added. (test): * JSTests/microbenchmarks/intl-collator-compare-long-prefix-primary-diff.js: Added. (test): * JSTests/microbenchmarks/intl-collator-compare-sort-short-keys.js: Added. (makeKeys): (test): * Source/JavaScriptCore/runtime/IntlObjectInlines.h: (JSC::identicalPrintableASCIIPrefixLength): (JSC::compareASCIIWithUCADUCET): Canonical link: https://commits.webkit.org/324132@main
webkit-commit-queue
force-pushed
the
collator-compare
branch
from
October 19, 2026 16:16
6fd5672 to
7b2dc73
Compare
Collaborator
|
Committed 324132@main (7b2dc73): https://commits.webkit.org/324132@main Reviewed commits have been landed. Closing PR #77424 and removing active labels. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
7b2dc73
6fd5672