Skip to content

Commit 8da3079

Browse files
committed
Expand bench-api-headers benchmarks
1 parent bb34758 commit 8da3079

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/workerd/tests/bench-api-headers.c++

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ struct ApiHeaders: public benchmark::Fixture {
1616

1717
struct Header {
1818
bool append;
19-
kj::StringPtr name;
20-
kj::StringPtr value;
19+
jsg::ByteString name;
20+
jsg::ByteString value;
2121
};
2222

2323
void SetUp(benchmark::State& state) noexcept(true) override {
@@ -51,22 +51,22 @@ struct ApiHeaders: public benchmark::Fixture {
5151
kj::Own<TestFixture> fixture;
5252
kj::Own<kj::HttpHeaderTable> table;
5353
kj::Own<kj::HttpHeaders> kjHeaders;
54-
Header kHeaders[13] = {Header{false, "Host"_kj, "example.com"_kj},
55-
Header{false, "User-Agent"_kj,
56-
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"_kj},
57-
Header{false, "Accept"_kj,
58-
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"_kj},
59-
Header{false, "Accept-Language"_kj, "en-US,en;q=0.9"_kj},
60-
Header{false, "Accept-Encoding"_kj, "gzip, deflate, br"_kj},
61-
Header{false, "Content-Type"_kj, "application/json; charset=utf-8"_kj},
62-
Header{false, "Authorization"_kj,
63-
"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0"_kj},
64-
Header{false, "Cache-Control"_kj, "no-cache, no-store, must-revalidate"_kj},
65-
Header{false, "Content-Length"_kj, "1234"_kj},
66-
Header{false, "Referer"_kj, "https://www.example.com/page?query=value&other=param"_kj},
67-
Header{false, "X-Forwarded-For"_kj, "203.0.113.1, 198.51.100.17"_kj},
68-
Header{true, "Set-Cookie"_kj, "new_session=token123; Path=/; Secure; HttpOnly"_kj},
69-
Header{true, "Set-Cookie"_kj, "new_session=token124; Path=/abc; Secure; HttpOnly"_kj}};
54+
Header kHeaders[13] = {Header{false, "Host"_bs, "example.com"_bs},
55+
Header{false, "User-Agent"_bs,
56+
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"_bs},
57+
Header{false, "Accept"_bs,
58+
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"_bs},
59+
Header{false, "Accept-Language"_bs, "en-US,en;q=0.9"_bs},
60+
Header{false, "Accept-Encoding"_bs, "gzip, deflate, br"_bs},
61+
Header{false, "Content-Type"_bs, "application/json; charset=utf-8"_bs},
62+
Header{false, "Authorization"_bs,
63+
"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0"_bs},
64+
Header{false, "Cache-Control"_bs, "no-cache, no-store, must-revalidate"_bs},
65+
Header{false, "Content-Length"_bs, "1234"_bs},
66+
Header{false, "Referer"_bs, "https://www.example.com/page?query=value&other=param"_bs},
67+
Header{false, "X-Forwarded-For"_bs, "203.0.113.1, 198.51.100.17"_bs},
68+
Header{true, "Set-Cookie"_bs, "new_session=token123; Path=/; Secure; HttpOnly"_bs},
69+
Header{true, "Set-Cookie"_bs, "new_session=token124; Path=/abc; Secure; HttpOnly"_bs}};
7070
};
7171

7272
// initialization performs a lot of copying, benchmark it

0 commit comments

Comments
 (0)