moonchen opened a new pull request, #13376: URL: https://github.com/apache/trafficserver/pull/13376
**Draft — putting this up so folks can try it if they want. Still pending my own production testing; not proposing to merge yet.** A stack of scalar optimizations to the HTTP header-parsing hot path (`src/proxy/hdrs/`), plus a micro-benchmark harness. Portable C++ only — no SIMD/Highway dependency, and **no changes to the well-known-string table** (those would invalidate cache). ### Changes - **Micro-benchmark harness** (`tools/benchmark/benchmark_HdrParse.cc`, gated by `-DENABLE_BENCHMARKS=ON`) covering the request/response/mime/url/wks parse paths, with realistic and adversarial corpora. - **WKS name hashing**: inline FNV-1a over a branchless ASCII case-fold, dropping a per-byte libc `toupper()` and the out-of-line hash object from the hot path. Hash values are unchanged. - **WKS interning** hardened against hash collisions (byte-compare on bucket hit), plus a `static_assert` that no two well-known strings share a hash slot (replacing the startup collision scan + `abort()`). - **URL compliance scan**: per-byte libc ctype → range check + portable SWAR. - **Duplicate fields**: skip the O(n) duplicate search for provably-new names (presence-bit / 128-bit Bloom); O(1) tail-append for adjacent duplicates (e.g. consecutive `Set-Cookie`). - **`validate_hdr_request_target`** folded to a truth table. ### Correctness - `test_proxy_hdrs`: 436,859 assertions / 41 cases pass. - WKS hash values and cache keys byte-identical to master. - Differential-fuzz tests added for the three refactors (fused name-scan parity, SWAR-vs-scalar URL scan, tail-append-vs-attach equivalence). ### Performance (measured on two desktop-class computers — independent validation welcome) Parse-path micro-benchmark (clang, RelWithDebInfo): realistic request **−30%**, modern-browser request **−41%**, URL **−41%**, MIME fields **−25%**, WKS tokenize **−58%**, response **−14%**. End-to-end (10GbE, RAM-cache hit, ATS pinned to isolated cores; metric = CPU per 1k requests): HTTP/1.1 plain **−3.7%**, HTTP/1.1 TLS **−3.9%**, HTTP/2 TLS **−6.3%**. Parsing is a fraction of the request path, so the micro-bench delta dilutes end-to-end as expected. ### Not included (on purpose) - Interning modern-browser header names (`sec-ch-ua*`, `sec-fetch-*`) as new WKS entries — that changes the WKS table and would invalidate cache; also contentious on perf. - No dependency on #13320 (the Highway SIMD work); this is the independent scalar path. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
