Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4135fdaadd966813364a321d07ab051824c9082c
      
https://github.com/WebKit/WebKit/commit/4135fdaadd966813364a321d07ab051824c9082c
  Author: Chris Dumez <[email protected]>
  Date:   2026-01-06 (Tue, 06 Jan 2026)

  Changed paths:
    M Source/WTF/wtf/text/StringCommon.h

  Log Message:
  -----------
  Micro-optimize `WTF::equal(const CharacterType* a, std::span<const 
CharacterType> b)`
https://bugs.webkit.org/show_bug.cgi?id=304919

Reviewed by Yusuke Suzuki.

Micro-optimize `WTF::equal(const CharacterType* a, std::span<const 
CharacterType> b)`
as recommended by Claude AI.

Here are micro-benchmark results:

Length      Original (ns) Optimized (ns)     Speedup      Improvement
----------------------------------------------------------------------
2                    1.80           1.58       1.141x            +12.3%
3                    1.60           1.58       1.008x            +0.8%
4                    1.59           1.58       1.004x            +0.4%
5                    1.58           1.58       0.999x            -0.1%
6                    1.58           1.57       1.006x            +0.6%
7                    1.57           1.57       1.001x            +0.1%
8                    1.57           1.57       1.001x            +0.1%
9                    1.65           1.62       1.018x            +1.7%
12                   1.57           1.58       0.997x            -0.3%
16                   1.57           1.57       1.001x            +0.1%
17                   1.56           1.57       0.990x            -1.0%
20                   1.57           1.58       0.993x            -0.7%
24                   1.58           1.57       1.007x            +0.7%
32                   1.59           1.57       1.013x            +1.3%
33                   1.66           1.62       1.022x            +2.1%
40                   1.67           1.64       1.019x            +1.9%
48                   1.70           1.61       1.054x            +5.2%
64                   1.83           1.63       1.123x            +10.9%
65                   1.83           1.70       1.074x            +6.9%
80                   2.11           1.72       1.225x            +18.3%
100                  2.36           2.20       1.072x            +6.8%
128                  2.96           2.53       1.173x            +14.7%
256                  5.37           4.79       1.122x            +10.8%
512                  9.67           8.79       1.100x            +9.1%
1024                18.93          16.69       1.134x            +11.8%
2048                46.76          37.97       1.231x            +18.8%
4096                86.65          76.17       1.138x            +12.1%

----------------------------------------------------------------------
Average speedup: 1.136x
Total improvement: 12.0%

* Source/WTF/wtf/text/StringCommon.h:
(WTF::equal):

Canonical link: https://commits.webkit.org/305181@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to