Skip to content

Speed up querystring callback dispatch - #316

Merged
Kludex merged 8 commits into
mainfrom
speed-up-querystring-callback-dispatch
Aug 9, 2026
Merged

Speed up querystring callback dispatch#316
Kludex merged 8 commits into
mainfrom
speed-up-querystring-callback-dispatch

Conversation

@Kludex

@Kludex Kludex commented Aug 9, 2026

Copy link
Copy Markdown
Owner

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

Review in cubic

@codspeed-hq

codspeed-hq Bot commented Aug 9, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 70.17%

⚡ 1 improved benchmark
✅ 4 untouched benchmarks

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation test_querystring_large_form 912.9 µs 536.5 µs +70.17%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing speed-up-querystring-callback-dispatch (f219559) with main (a034d65)

Open in CodSpeed

@Kludex

Kludex commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

Thanks. The final revision retains the improvement: CodSpeed reports a 70.17% efficiency improvement for test_querystring_large_form (912.9 µs to 536.5 µs), with the other four benchmarks unchanged. The PR description is up to date; no code change is needed.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

Comment thread python_multipart/multipart.py Outdated
@Kludex

Kludex commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

Updated callback dispatch in b1c3c9e to use shared _noop_event and _noop_data defaults, removing repeated is not None checks without allocating lambdas. Follow-up de37a65 resolves callbacks once per chunk, preserves explicit-None compatibility, and tests both omitted and None callbacks. Local lint, mypy, and all 160 tests pass with 100% statement coverage.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 1 file (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread python_multipart/multipart.py Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread python_multipart/multipart.py
Comment thread python_multipart/multipart.py Outdated
@Kludex
Kludex merged commit aa7048c into main Aug 9, 2026
15 checks passed
@Kludex
Kludex deleted the speed-up-querystring-callback-dispatch branch August 9, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant