Hi,

please find attached four patches that reduce the CPU cost of the
normalize-uri actions. The first three replace byte-at-a-time loops in
src/uri_normalizer.c and remove a repeated scan in the query sort
comparator; the last one extends the reg-test, whose existing cases are
all too short to reach the paths that changed. None of them changes the
output.

Measured on a 24-core AMD EPYC 7413, gcc 8.5.0, -O2 -march=native,
keep-alive, CPU time per request:

  URL                     before        after      change
  8 byte path             266.4 us     266.0 us    none measurable
  60 parameter query      314.02 us    311.17 us   -0.9%
  427 parameter query    1137.52 us   1062.53 us   -6.6%

Those are whole-request figures. Against a build with the six actions
removed the same 427 parameter case costs 989.67 us, so what the
actions themselves add goes from 218.3 us to 142.9 us, about a third
less. The gain comes almost entirely from the comparator change and
scales with the parameter count, so short URIs get nothing out of it.

One point worth raising here: the second patch needs a small struct
instead of a bare struct ist. It stays at 16 bytes on 64-bit, so the
ERR_ALLOC threshold is unchanged there, but on 32-bit it grows from 8 to
12 bytes and that bound drops by a third. I can rework it to keep the
old bound if you prefer.

These patches stay inside uri_normalizer.c and do not touch the action
layer, so they should survive the conversion to converters that has been
discussed.

Best regards
Youngkwang Lee

위 전자우편 및 그에 포함된 정보는 위에 기재된 수신인만을 위해 발송되는 것으로서 보안을 유지해야 하는 정보 및 법률상 또는 다른 사유로 
인하여 공개가 금지된 정보가 들어 있을 수 있습니다.
귀하가 이 전자우편의 지정 수신인이 아니면 이를 무단으로 보유, 복제, 전송, 배포, 공개할 수 없으며, 일부의 내용이라도 보유, 복제, 
배포, 공개해서는 안됩니다.
그러므로, 잘못 수신된 경우에는 즉시 네이버 클라우드 개인정보보호([email protected])로 연락하여 
주시고, 원본 및 사본과 그에 따른 첨부 문서를 모두 삭제하여 주시기 바랍니다. 협조하여 주셔서 감사합니다.
​
This email and the information contained in this email are intended solely for 
the recipient(s) addressed above and may contain information that is 
confidential and/or privileged or whose disclosure is prohibited by law or 
other reasons.
If you are not the intended recipient of this email, please be advised that any 
unauthorized storage, duplication, dissemination, distribution or disclosure of 
all or part of this email is strictly prohibited.
If you received this email in error, please immediately contact NAVER Cloud 
Privacy([email protected]) and delete this email and any copies 
and attachments from your system. Thank you for your cooperation.

Attachment: 0001-OPTIM-uri_normalizer-bulk-copy-runs-between-percent-.patch
Description: Binary data

Attachment: 0002-OPTIM-uri_normalizer-compute-query-parameter-names-o.patch
Description: Binary data

Attachment: 0003-OPTIM-uri_normalizer-bulk-copy-the-parts-around-enco.patch
Description: Binary data

Attachment: 0004-REGTESTS-uri_normalizer-cover-long-URIs-and-many-que.patch
Description: Binary data

Reply via email to