MCPcopy Create free account
hub / github.com/boostorg/beast / testSpeed

Method testSpeed

test/bench/parser/bench_parser.cpp:286–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284 };
285
286 void
287 testSpeed()
288 {
289 static std::size_t constexpr Trials = 5;
290 static std::size_t constexpr Repeat = 500;
291
292 creq_ = build_corpus(N/2, std::true_type{});
293 cres_ = build_corpus(N/2, std::false_type{});
294
295 log << "sizeof(request parser) == " <<
296 sizeof(null_parser<true>) << '\n';
297
298 log << "sizeof(response parser) == " <<
299 sizeof(null_parser<false>)<< '\n';
300
301 testcase << "Parser speed test, " <<
302 ((Repeat * size_ + 512) / 1024) << "KB in " <<
303 (Repeat * (creq_.size() + cres_.size())) << " messages";
304
305#if 0
306 timedTest(Trials, "http::parser",
307 [&]
308 {
309 testParser2<request_parser<dynamic_body>>(Repeat, creq_);
310 testParser2<response_parser<dynamic_body>>(Repeat, cres_);
311 });
312#endif
313#if 1
314 timedTest(Trials, "http::basic_parser",
315 [&]
316 {
317 testParser2<bench_parser<
318 true, dynamic_body, fields> >(
319 Repeat, creq_);
320 testParser2<bench_parser<
321 false, dynamic_body, fields>>(
322 Repeat, cres_);
323 });
324#if 1
325 timedTest(Trials, "nodejs_parser",
326 [&]
327 {
328 testParser1<nodejs_parser<
329 true, dynamic_body, fields>>(
330 Repeat, creq_);
331 testParser1<nodejs_parser<
332 false, dynamic_body, fields>>(
333 Repeat, cres_);
334 });
335#endif
336#endif
337 pass();
338 }
339
340 void run() override
341 {

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected