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

Include A Zig Library In Speed Comparison #514

Merged
merged 5 commits into from
Sep 25, 2023

Conversation

pascaldekloe
Copy link
Contributor

Benchmark libzuri when available [optional].

@anonrig
Copy link
Member

anonrig commented Sep 23, 2023

Thank you. I've been following the benchmark issue on your repository for quite some time now. Happy to see this!

Would you mind sharing the results as well?

@anonrig anonrig requested a review from lemire September 23, 2023 14:06
@anonrig
Copy link
Member

anonrig commented Sep 23, 2023

Can you also run the linter?

@pascaldekloe
Copy link
Contributor Author

The result of bbc_bench on Apple M1 is as follows. Note that Zuri does not validate UTF-8.

Permission denied, xnu/kpc requires root privileges.
Unable to determine clock rate from sysctl: hw.cpufrequency: No such file or directory
2023-09-23T15:56:41+02:00
Running ./benchmarks/bbc_bench
Run on (8 X 24.0445 MHz CPU s)
CPU Caches:
  L1 Data 64 KiB (x8)
  L1 Instruction 128 KiB (x8)
  L2 Unified 4096 KiB (x2)
Load Average: 1.27, 1.72, 1.60
ada spec: Ada follows whatwg/url
bad urls: ---------------------
ada---count of bad URLs       0
servo/url---count of bad URLs 0
whatwg---count of bad URLs    0
curl---count of bad URLs      0
zuri---count of bad URLs      0
-------------------------------

bytes/URL: 95.888889
curl spec: Curl follows RFC3986, not whatwg/url
curl version : 8.1.2
input bytes: 863
number of URLs: 9
performance counters: No privileged access (sudo may help).
rust version : 1.72.0
zuri spec: Zuri follows RFC3986, not whatwg/url
--------------------------------------------------------------------------------------------
Benchmark                                  Time             CPU   Iterations UserCounters...
--------------------------------------------------------------------------------------------
BasicBench_AdaURL_href                  2461 ns         2459 ns       284618 speed=351.007M/s time/byte=2.84894ns time/url=273.182ns url/s=3.66056M/s
BasicBench_AdaURL_aggregator_href       1505 ns         1504 ns       464570 speed=573.91M/s time/byte=1.74243ns time/url=167.08ns url/s=5.98516M/s
BasicBench_whatwg                       5571 ns         5481 ns       130858 speed=157.465M/s time/byte=6.35063ns time/url=608.955ns url/s=1.64216M/s
BasicBench_CURL                        11337 ns        11331 ns        60210 speed=76.1631M/s time/byte=13.1297ns time/url=1.25899us url/s=794.285k/s
BasicBench_ZURI                         2303 ns         2301 ns       301962 speed=375.087M/s time/byte=2.66605ns time/url=255.644ns url/s=3.91168M/s
BasicBench_ServoUrl                     8154 ns         8148 ns        85963 speed=105.913M/s time/byte=9.44172ns time/url=905.356ns url/s=1.10454M/s

@pascaldekloe
Copy link
Contributor Author

Can you also run the linter?

Certainly. I need a little help. Can't find any mention of a linter in the docs or makefiles. How does one run lint?

@anonrig
Copy link
Member

anonrig commented Sep 23, 2023

Can you also run the linter?

Certainly. I need a little help. Can't find any mention of a linter in the docs or makefiles. How does one run lint?

We need better documentation for internal tooling. You need to run this command https://github.com/ada-url/ada/blob/main/tools/lint_and_format.py

@pascaldekloe
Copy link
Contributor Author

UTF-8 validation is super slow in Zig. We could use some of that Lemire stuff in there. 😁

@pascaldekloe
Copy link
Contributor Author

One more change. Sorry about that @anonrig. I never realized how bad-ass string null-termination can be. Such a bad reputation while it significantly improves both code and performance.

--------------------------------------------------------------------------------------------
Benchmark                                  Time             CPU   Iterations UserCounters...
--------------------------------------------------------------------------------------------
BasicBench_AdaURL_href                  2366 ns         2366 ns       286848 speed=364.675M/s time/byte=2.74217ns time/url=262.943ns url/s=3.8031M/s
BasicBench_AdaURL_aggregator_href       1443 ns         1443 ns       482489 speed=598.028M/s time/byte=1.67216ns time/url=160.342ns url/s=6.23668M/s
BasicBench_whatwg                       5181 ns         5181 ns       134553 speed=166.562M/s time/byte=6.00376ns time/url=575.694ns url/s=1.73703M/s
BasicBench_CURL                        10997 ns        10997 ns        63819 speed=78.4746M/s time/byte=12.743ns time/url=1.22191us url/s=818.39k/s
BasicBench_ZURI                         2173 ns         2173 ns       322217 speed=397.1M/s time/byte=2.51826ns time/url=241.473ns url/s=4.14125M/s
BasicBench_ServoUrl                     7836 ns         7836 ns        89375 speed=110.132M/s time/byte=9.08ns time/url=870.671ns url/s=1.14854M/s

@anonrig anonrig merged commit 7e8133d into ada-url:main Sep 25, 2023
31 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.

2 participants