Speed up querystring callback dispatch

Merged
KL
2mo ago
+76-11

Summary

  • resolve QuerystringParser callbacks through fixed callback keys once per input chunk instead of using BaseParser.callback() for every event
  • use shared no-op defaults to eliminate repeated optional-callback checks
  • avoid callback-name construction and an extra Python method call on each parsed field event
  • preserve zero-length data suppression and support omitted callbacks through shared no-op functions

Performance

The latest CodSpeed simulation reports a 70.17% efficiency improvement for test_querystring_large_form, from 912.9 µs to 536.5 µs. A same-environment local wall-time benchmark on Python 3.13 improved from approximately 80 µs to 49 µs (about 39%). The other four CodSpeed benchmarks are unchanged.

Validation

  • 160 tests pass
  • 100% statement coverage
  • Ruff passes
  • mypy passes
  • source distribution check passes