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

using a table-based convert_hex_to_binary function for better speed #478

Merged
merged 4 commits into from
Aug 29, 2023

Conversation

lemire
Copy link
Member

@lemire lemire commented Aug 21, 2023

This is an alternative to #473

Using the search-params benchmark, we can use benchmarks/bench_search_params to test the speed at which we can parse search parameters. This task is percent-decoding intensive.

GCC 11, Ice Lake processor.

Main:

-----------------------------------------------------------------------------------
Benchmark                         Time             CPU   Iterations UserCounters...
-----------------------------------------------------------------------------------
url_search_params_AdaURL      65900 ns        65735 ns        10671 GHz=3.19635 cycle/byte=11.6984 cycles/url=32.773k instructions/byte=40.3667 instructions/cycle=3.45062 instructions/ns=11.0294 instructions/url=113.087k ns/url=10.2532k speed=170.473M/s time/byte=5.86604ns time/url=16.4337us url/s=60.8505k/s

PR #473

-----------------------------------------------------------------------------------
Benchmark                         Time             CPU   Iterations UserCounters...
-----------------------------------------------------------------------------------
url_search_params_AdaURL      65202 ns        65028 ns        10785 GHz=3.19652 cycle/byte=11.5858 cycles/url=32.4575k instructions/byte=40.3469 instructions/cycle=3.48245 instructions/ns=11.1317 instructions/url=113.032k ns/url=10.154k speed=172.325M/s time/byte=5.80298ns time/url=16.257us url/s=61.5118k/s

Table approach:

-----------------------------------------------------------------------------------
Benchmark                         Time             CPU   Iterations UserCounters...
-----------------------------------------------------------------------------------
url_search_params_AdaURL      57930 ns        57759 ns        11989 GHz=1.99858 cycle/byte=9.17089 cycles/url=25.6923k instructions/byte=40.4051 instructions/cycle=4.40579 instructions/ns=8.80533 instructions/url=113.195k ns/url=12.8552k speed=194.012M/s time/byte=5.15432ns time/url=14.4398us url/s=69.253k/s

The table-based approach more than 10% faster than our main branch and, according to these tests, faster than PR #473

cc @ttsugriy

This is a precursor to #459

@anonrig anonrig merged commit b0d2c47 into main Aug 29, 2023
28 checks passed
@anonrig anonrig deleted the table_convert_hex_to_binary branch August 29, 2023 20:20
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