Hi Willy,

this is v2 of the series, addressing your two remarks on v1.

Changes since v1:

- 1/4: after an escape, check whether the next byte is a '%' before
  calling memchr(), as you suggested. On a 5 kB path made only of
  escapes this saves 6.9 us per request (616.1 -> 609.2 us, -1.1%),
  on a 2 kB UTF-8 path 4.4 us (575.3 -> 571.0 us, -0.8%), which is
  about 2 to 4 ns per memchr() call avoided. An 8 byte path does not
  change.

- 2/4: the '=' lookup in the collection loop uses iststop() instead
  of memchr(). v1 had only been measured with 6 character names; with
  1-2 character names (467 parameters in 20 kB) the byte loop is 1.0%
  faster, with the 6 character ones 0.7%, consistent over five runs
  each. Small, but in the direction you expected, and the code is
  shorter. The numbers are in the commit message.

- 3/4: unchanged. It splits on '#' with istsplit(), so the first
  remark does not apply there.

- 4/4: only drops a duplicated Signed-off-by line.

The output is unchanged. v1, v2 with only the first change, and v2
with both were run over 300k generated inputs (escapes, UTF-8 runs,
short names, destination sizes on both sides of the truncation point,
strict and non-strict): 3.59M comparisons of output and error code, no
difference. reg-tests/http-rules/normalize_uri.vtc passes with all
three, and with the series applied on current master (3e758361), where
src/uri_normalizer.c has not changed since 3.2.

The 32-bit note on 2/4 from v1 still stands (12 instead of 8 bytes per
parameter, so the ERR_ALLOC bound drops by a third there); I can rework
it if you prefer the old bound.

Best regards

Youngkwang Lee (4):
  OPTIM: uri_normalizer: bulk-copy runs between percent signs
  OPTIM: uri_normalizer: compute query parameter names only once
  OPTIM: uri_normalizer: bulk-copy the parts around encoded fragments
  REGTESTS: uri_normalizer: cover long URIs and many query parameters

 reg-tests/http-rules/normalize_uri.vtc |  38 +++++-
 src/uri_normalizer.c                   | 165 ++++++++++++++++---------
 2 files changed, 142 insertions(+), 61 deletions(-)


base-commit: 3e758361c327bdf9e15ef3e2db99f1e9166a9763
-- 
2.45.1



Reply via email to