Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add benchmark for URLPattern #917

Merged
merged 5 commits into from
Mar 20, 2025
Merged

Conversation

CarlosEduR
Copy link
Member

@CarlosEduR
Copy link
Member Author

--------------------------------------------------------------------------------------------
Benchmark                                  Time             CPU   Iterations UserCounters...
--------------------------------------------------------------------------------------------
BasicBench_AdaURL_href              33350647 ns     33343455 ns           21 GHz=4.06591 cycle/byte=15.4997 cycles/url=1.34629k instructions/byte=37.6602 instructions/cycle=2.42974 instructions/ns=9.8791 instructions/url=3.27114k ns/url=331.117 speed=260.564M/s time/byte=3.83783ns time/url=333.351ns url/s=2.99984M/s
BasicBench_AdaURL_aggregator_href   21845909 ns     21844879 ns           32 GHz=4.09228 cycle/byte=10.196 cycles/url=885.614 instructions/byte=25.9022 instructions/cycle=2.54044 instructions/ns=10.3962 instructions/url=2.24985k ns/url=216.411 speed=397.718M/s time/byte=2.51435ns time/url=218.394ns url/s=4.57888M/s
BasicBench_AdaURL_CanParse          15379453 ns     15379477 ns           46 GHz=4.09191 cycle/byte=7.10742 cycles/url=617.345 instructions/byte=18.7142 instructions/cycle=2.63306 instructions/ns=10.7742 instructions/url=1.6255k ns/url=150.87 speed=564.915M/s time/byte=1.77018ns time/url=153.756ns url/s=6.5038M/s
BasicBench_whatwg                   47904088 ns     47883077 ns           15 GHz=4.08728 cycle/byte=22.2022 cycles/url=1.92847k instructions/byte=63.6418 instructions/cycle=2.86646 instructions/ns=11.716 instructions/url=5.52788k ns/url=471.822 speed=181.444M/s time/byte=5.51135ns time/url=478.711ns url/s=2.08894M/s
BasicBench_CURL                    143282803 ns    143276462 ns            5 GHz=4.07499 cycle/byte=66.7428 cycles/url=5.79722k instructions/byte=184.355 instructions/cycle=2.76218 instructions/ns=11.2558 instructions/url=16.013k ns/url=1.42264k speed=60.6387M/s time/byte=16.4911ns time/url=1.43241us url/s=698.126k/s
BasicBench_ServoUrl                 75958293 ns     75954782 ns            9 GHz=4.08417 cycle/byte=35.5804 cycles/url=3.09048k instructions/byte=96.6788 instructions/cycle=2.71719 instructions/ns=11.0975 instructions/url=8.39744k ns/url=756.697 speed=114.385M/s time/byte=8.7424ns time/url=759.358ns url/s=1.3169M/s
BasicBench_AdaURL_URLPattern          177150 ns       177141 ns         3962 GHz=4.102 cycle/byte=0.0832208 cycles/url=90.3787k instructions/byte=0.220564 instructions/cycle=2.65034 instructions/ns=10.8717 instructions/url=239.535k ns/url=22.0329k speed=49.0463G/s time/byte=20.3889ps time/url=22.1426us url/s=45.1618k/s

@CarlosEduR
Copy link
Member Author

➜  ada git:(benchmarks/url-pattern) ✗ sudo ./build/benchmarks/urlpattern
2025-03-16T15:20:37-03:00
Running ./build/benchmarks/urlpattern
Run on (12 X 4034.01 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x6)
  L1 Instruction 32 KiB (x6)
  L2 Unified 256 KiB (x6)
  L3 Unified 12288 KiB (x1)
Load Average: 0.93, 0.48, 0.26
bad url patterns: ---------------------
urlpattern-parse---count of bad URLs      0
urlpattern-exec---count of bad URLs       0

bytes/URL: 49.875000
input bytes: 399
number of URLs: 8
performance counters: Enabled
---------------------------------------------------------------------------------------------
Benchmark                                   Time             CPU   Iterations UserCounters...
---------------------------------------------------------------------------------------------
BasicBench_AdaURL_URLPattern_Parse     179289 ns       179238 ns         3977 GHz=4.20162 cycle/byte=1.77148k cycles/url=88.3528k instructions/byte=4.79338k instructions/cycle=2.70586 instructions/ns=11.369 instructions/url=239.07k ns/url=21.0282k speed=2.22608M/s time/byte=449.219ns time/url=22.4048us url/s=44.6333k/s
BasicBench_AdaURL_URLPattern_Exec       16206 ns        16198 ns        45277 GHz=4.11032 cycle/byte=160.612 cycles/url=8.0105k instructions/byte=400.175 instructions/cycle=2.49157 instructions/ns=10.2412 instructions/url=19.9587k ns/url=1.94887k speed=24.632M/s time/byte=40.5976ns time/url=2.0248us url/s=493.875k/s

@CarlosEduR
Copy link
Member Author

2025-03-20T00:47:36-03:00
Running ./build/benchmarks/urlpattern
Run on (12 X 4031.31 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x6)
  L1 Instruction 32 KiB (x6)
  L2 Unified 256 KiB (x6)
  L3 Unified 12288 KiB (x1)
Load Average: 0.87, 0.72, 0.92
bad url patterns: ---------------------
urlpattern-parse---count of bad URLs      0
urlpattern-exec---count of bad URLs       0
urlpattern-test---count of bad URLs       0

bytes/URL: 49.875000
input bytes: 399
number of URLs: 8
performance counters: Enabled
---------------------------------------------------------------------------------------------
Benchmark                                   Time             CPU   Iterations UserCounters...
---------------------------------------------------------------------------------------------
BasicBench_AdaURL_URLPattern_Parse     182115 ns       182054 ns         3922 GHz=4.10219 cycle/byte=1.77465k cycles/url=88.5109k instructions/byte=4.79565k instructions/cycle=2.7023 instructions/ns=11.0853 instructions/url=239.183k ns/url=21.5765k speed=2.19166M/s time/byte=456.276ns time/url=22.7568us url/s=43.943k/s
BasicBench_AdaURL_URLPattern_Exec       15804 ns        15802 ns        43936 GHz=4.10912 cycle/byte=161.574 cycles/url=8.0585k instructions/byte=400.504 instructions/cycle=2.47876 instructions/ns=10.1855 instructions/url=19.9751k ns/url=1.96112k speed=25.25M/s time/byte=39.604ns time/url=1.97525us url/s=506.266k/s
BasicBench_AdaURL_URLPattern_Test       15825 ns        15824 ns        44400 GHz=4.10848 cycle/byte=162.125 cycles/url=5.88073k instructions/byte=400.531 instructions/cycle=2.4705 instructions/ns=10.15 instructions/url=14.5284k ns/url=1.43136k speed=25.2154M/s time/byte=39.6582ns time/url=1.43851us url/s=695.162k/s

@CarlosEduR CarlosEduR marked this pull request as ready for review March 20, 2025 03:48
@anonrig anonrig requested a review from lemire March 20, 2025 11:20
Copy link
Member

@lemire lemire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The set of examples is likely a bit too short. I know that in the context of JavaScript benchmarks and the like, we are happy with short input sets, but it is a methodological problem. E.g., the processors can learn branches and so forth.

I still recommend merging this, but I also recommend using a better input set in the future.

@anonrig anonrig merged commit 8b33aaa into ada-url:main Mar 20, 2025
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants