MCPcopy Create free account
hub / github.com/catboost/catboost / FindHeaderMoreRealisticUseCase

Function FindHeaderMoreRealisticUseCase

library/cpp/http/io/benchmark/main.cpp:53–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53void FindHeaderMoreRealisticUseCase(benchmark::State& state) {
54 TString requestHeaders(R"(Host: yandex.ru
55User-Agent: Mozilla/5.0 ...
56Accept: */*
57Accept-Language: en-US,en;q=0.5
58Accept-Encoding: gzip, deflate, br
59Content-Type: text/plain;charset=UTF-8
60Content-Length: 1234
61Origin: https://a.yandex-team.ru
62Connection: keep-alive
63Referer: https://a.yandex-team.ru/
64Sec-Fetch-Dest: empty
65Sec-Fetch-Mode: no-cors
66Sec-Fetch-Site: cross-site
67TE: trailers)");
68 TStringInput stream(requestHeaders);
69 THttpHeaders headers(&stream);
70 Y_ENSURE(headers.FindHeader("Content-Type"));
71 for (auto _ : state) {
72 auto header = headers.FindHeader("Content-Type");
73 benchmark::DoNotOptimize(header);
74 }
75}
76
77BENCHMARK(FindHeaderFirstMatch);
78BENCHMARK(FindHeaderNoMatchSameSize);

Callers

nothing calls this directly

Calls 2

FindHeaderMethod · 0.80
DoNotOptimizeFunction · 0.50

Tested by

no test coverage detected