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

fix headers bench: use Vec::reserve for reserve buf capacity #215

Merged
merged 3 commits into from
Jul 13, 2024

Conversation

kanarus
Copy link
Member

@kanarus kanarus commented Jul 13, 2024

Fix response::Headers::_write_to, for-benchmark wrapper of write_unchecked_to, to reserve buf capacity by Vec::reserve instead of Vec::reserve_exact. Benchmark examples:

before

test write_02_http_crate       ... bench:         118.08 ns/iter (+/- 21.05)
test write_03_fxmap            ... bench:          94.93 ns/iter (+/- 5.96)
test write_03_header_hashbrown ... bench:          94.41 ns/iter (+/- 7.58)
test write_03_ohkami           ... bench:         153.62 ns/iter (+/- 12.09)
test write_04_headermap        ... bench:         105.58 ns/iter (+/- 18.24)

after

test write_02_http_crate       ... bench:         116.04 ns/iter (+/- 2.89)
test write_03_fxmap            ... bench:         100.20 ns/iter (+/- 4.12)
test write_03_header_hashbrown ... bench:          99.91 ns/iter (+/- 2.76)
test write_03_ohkami           ... bench:         117.10 ns/iter (+/- 3.13)
test write_04_headermap        ... bench:         124.93 ns/iter (+/- 3.37)

and

  • Activate "inline-more" feature of hashbrown
  • Introduce size tracking in header_hashbrown
  • Fix input to the same & larger

for more fairness

@kanarus kanarus merged commit 2ec767d into main Jul 13, 2024
3 checks passed
@kanarus kanarus deleted the fix/headers_bench branch July 13, 2024 02:42
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.

1 participant