|
28 | 28 | // path at all -- there is no compile-time expression on the v2.0 |
29 | 29 | // branch that reproduces the v1 numbers. |
30 | 30 | // |
31 | | -// Baseline environment (full details in test/PERFORMANCE.md): |
| 31 | +// Baseline environment (full details in test/PERFORMANCE.md). Both the |
| 32 | +// sizeof constants AND the get_headers ns/call constant are selected |
| 33 | +// per-stdlib at compile time (TASK-084 split the ns/call constant, which |
| 34 | +// had previously reused the libc++ value on libstdc++). The host triple |
| 35 | +// below describes the libc++ reference host; the libstdc++ ns/call |
| 36 | +// provenance is documented against its own branch lower in this file. |
32 | 37 | // * master SHA : d8b055e ("Migrate to libmicrohttpd 1.0.0 API") |
33 | | -// * host triple : aarch64-apple-darwin25.3.0 (Apple silicon) |
| 38 | +// * host triple : aarch64-apple-darwin25.3.0 (Apple silicon, libc++) |
34 | 39 | // * compiler : Apple clang 21.0.0 |
35 | | -// * C++ stdlib : libc++ (LLVM) |
| 40 | +// * C++ stdlib : libc++ (LLVM) [libstdc++: see ns/call branch] |
36 | 41 | // * build profile : -std=c++20 -O3 (release; no sanitizers) |
37 | 42 | // * libmicrohttpd : 1.0.5 (only relevant to ns/call measurement) |
38 | 43 | // |
@@ -91,11 +96,49 @@ inline constexpr std::size_t V1_STD_MAP_STRING_BOOL_SIZEOF = 24; |
91 | 96 | // bench_get_headers.cpp), std::chrono::steady_clock, asm-volatile |
92 | 97 | // sink to defeat dead-store elimination. |
93 | 98 | // |
| 99 | +// This constant is selected per-stdlib (TASK-084). It was previously a |
| 100 | +// single mono-platform literal (the libc++ value) reused unchanged on |
| 101 | +// libstdc++/Linux; TASK-084 re-measured the libstdc++ value so the |
| 102 | +// TASK-039 >=10x speedup gate has a real per-stdlib baseline. The |
| 103 | +// dominant per-call cost is the std::map node layout + 16 string copies, |
| 104 | +// which differs between the two standard libraries' map implementations. |
| 105 | +// |
| 106 | +// We commit the conservatively rounded LOWER end of each platform's |
| 107 | +// observed range so the >=10x ratio assertion keeps margin under host |
| 108 | +// jitter (a lower v1 baseline makes the gate strictly harder, never |
| 109 | +// spuriously easier). |
| 110 | +#if defined(__GLIBCXX__) |
| 111 | +// libstdc++ (Linux / GCC): re-measured under TASK-084. |
| 112 | +// |
| 113 | +// Provenance: gcc-14 (g++-14 14.2.0, Ubuntu 24.04, the verify-build.yml |
| 114 | +// performance lane's toolchain), -std=c++20 -O3 -DNDEBUG, libstdc++ |
| 115 | +// __GLIBCXX__=20240908. Measured via the Step-3 recipe in |
| 116 | +// test/v1_baseline/README.md. |
| 117 | +// |
| 118 | +// Two measurement vantage points were taken (a native x86-64 |
| 119 | +// verify-build.yml runner is not reachable from the macOS maintainer |
| 120 | +// host, so the value is filled from the most authoritative available |
| 121 | +// libstdc++ measurement per the README re-measurement procedure): |
| 122 | +// * native aarch64 libstdc++ (Apple-silicon Linux container, no |
| 123 | +// emulation) : ~667 .. 742 ns/call across reps. |
| 124 | +// * emulated x86-64 libstdc++ (Docker on Apple silicon) : ~4477 .. |
| 125 | +// 5029 ns/call -- inflated ~6x by binary translation, recorded only |
| 126 | +// to confirm libstdc++'s map is comparable-or-slower than libc++, |
| 127 | +// NOT used to set the literal. |
| 128 | +// We commit the rounded lower end of the un-emulated native range |
| 129 | +// (~667 ns rounded down to 640 ns) as the conservative libstdc++ |
| 130 | +// baseline. |
| 131 | +inline constexpr double V1_GET_HEADERS_NS_PER_CALL = 640.0; |
| 132 | +#elif defined(_LIBCPP_VERSION) |
| 133 | +// libc++ (macOS / Apple clang) -- the original TASK-039 measurement. |
| 134 | +// |
94 | 135 | // Measured median on the baseline host: 767.665 ns/call (range |
95 | 136 | // 756 .. 784 across the 11 reps). We commit the rounded lower end of |
96 | | -// the observed range (756 ns rounded to 760 ns) as a conservative number; |
97 | | -// the >=10x assertion has comfortable margin regardless of host jitter. |
| 137 | +// the observed range (756 ns rounded to 760 ns) as a conservative number. |
98 | 138 | inline constexpr double V1_GET_HEADERS_NS_PER_CALL = 760.0; |
| 139 | +#else |
| 140 | +#error "Unknown C++ stdlib: re-measure v1 get_headers ns/call (see test/v1_baseline/README.md) and add a branch in v1_constants.hpp" |
| 141 | +#endif |
99 | 142 |
|
100 | 143 | } // namespace httpserver::v1_baseline |
101 | 144 |
|
|
0 commit comments