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

header.go Referer() optimize #1313

Merged
merged 3 commits into from Jun 6, 2022
Merged

Commits on Jun 5, 2022

  1. args.go GetBool(): use switch with string casting

    This should be optimized by Go compiler itself so the b2s() call is not needed.
    
    It was previously done by this but changed in
    1e7885e
    stokito committed Jun 5, 2022
    Copy the full SHA
    6f7e115 View commit details
    Browse the repository at this point in the history
  2. header.go Referer() optimize

    Use direct peekArgBytes() instead of PeekBytes() that will check for special headers
    stokito committed Jun 5, 2022
    Copy the full SHA
    e6bb8dd View commit details
    Browse the repository at this point in the history
  3. header_timing_test.go BenchmarkRequestHeaderPeekBytesSpecialHeader

    The old BenchmarkRequestHeaderPeekBytesCanonical and BenchmarkRequestHeaderPeekBytesNonCanonical are in fact just measured the header normalization.
    But it's anyway is benchmarked separately.
    Results was almost the same: 1.5 ns/op.
    
    Instead, let's reuse the benches to find a difference between peeking of special (Host, CT) and custom headers.
    stokito committed Jun 5, 2022
    Copy the full SHA
    a052da7 View commit details
    Browse the repository at this point in the history