Skip to content

Commit

Permalink
Optimize URL Decoding (#8622)
Browse files Browse the repository at this point in the history
This PR is intended to optimize the URL decoding performance, especially on large URLs. Additionally, a test case for large URLs has been added.

When tested on V100, baseline performance at 7521c3f
```
------------------------------------------------------------------------------------------------------------------
Benchmark                                                        Time             CPU   Iterations UserCounters...
------------------------------------------------------------------------------------------------------------------
UrlDecode<10>/url_decode_10pct/100000000/10/manual_time        111 ms          111 ms            6 bytes_per_second=11.7959G/s
UrlDecode<10>/url_decode_10pct/10000000/100/manual_time        107 ms          107 ms            7 bytes_per_second=9.0136G/s
UrlDecode<10>/url_decode_10pct/1000000/1000/manual_time        107 ms          107 ms            7 bytes_per_second=8.76755G/s
UrlDecode<50>/url_decode_50pct/100000000/10/manual_time        129 ms          129 ms            5 bytes_per_second=10.144G/s
UrlDecode<50>/url_decode_50pct/10000000/100/manual_time        126 ms          126 ms            6 bytes_per_second=7.70821G/s
UrlDecode<50>/url_decode_50pct/1000000/1000/manual_time        122 ms          122 ms            6 bytes_per_second=7.66783G/s
```

This PR
```
------------------------------------------------------------------------------------------------------------------
Benchmark                                                        Time             CPU   Iterations UserCounters...
------------------------------------------------------------------------------------------------------------------
UrlDecode<10>/url_decode_10pct/100000000/10/manual_time       97.5 ms         97.6 ms            7 bytes_per_second=13.3669G/s
UrlDecode<10>/url_decode_10pct/10000000/100/manual_time       28.8 ms         28.8 ms           24 bytes_per_second=33.6024G/s
UrlDecode<10>/url_decode_10pct/1000000/1000/manual_time       21.8 ms         21.8 ms           32 bytes_per_second=42.9686G/s
UrlDecode<50>/url_decode_50pct/100000000/10/manual_time        109 ms          109 ms            6 bytes_per_second=11.9786G/s
UrlDecode<50>/url_decode_50pct/10000000/100/manual_time       30.2 ms         30.3 ms           23 bytes_per_second=32.0311G/s
UrlDecode<50>/url_decode_50pct/1000000/1000/manual_time       22.7 ms         22.8 ms           31 bytes_per_second=41.1086G/s
```

close #8030

Authors:
  - https://github.com/gaohao95

Approvers:
  - Nghia Truong (https://github.com/ttnghia)
  - David Wendt (https://github.com/davidwendt)
  - Vyas Ramasubramani (https://github.com/vyasr)

URL: #8622
  • Loading branch information
gaohao95 authored Aug 30, 2021
1 parent 1d4a2fb commit 4945198
Show file tree
Hide file tree
Showing 3 changed files with 287 additions and 192 deletions.
5 changes: 3 additions & 2 deletions cpp/benchmarks/string/url_decode_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ void BM_url_decode(benchmark::State& state)
BENCHMARK_TEMPLATE_DEFINE_F(UrlDecode, name, esc_seq_pct) \
(::benchmark::State & state) { BM_url_decode<esc_seq_pct>(state); } \
BENCHMARK_REGISTER_F(UrlDecode, name) \
->RangeMultiplier(10) \
->Ranges({{100, 100000}, {10, 10000}}) \
->Args({100000000, 10}) \
->Args({10000000, 100}) \
->Args({1000000, 1000}) \
->Unit(benchmark::kMillisecond) \
->UseManualTime();

Expand Down
Loading

0 comments on commit 4945198

Please sign in to comment.