Speed up multipart callback dispatch - #317
Conversation
Merging this PR will improve performance by 24.15%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Simulation | test_parse_multipart_large_form |
3.7 ms | 3 ms | +24.15% |
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-multipart-callback-dispatch (d74fe57) with main (d9cb4c6)
Footnotes
-
5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0c875e1e81
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
After rebasing onto the corrected benchmark lifecycle from #318, CodSpeed now reports a 24.15% efficiency improvement for the 100-field complete-parse benchmark (3.7 ms to 3.0 ms), with the other four corrected benchmarks unchanged. The report warns that the runs used different environments, while same-environment local measurements show a 17.1% improvement for the equivalent workload. The Cubic finding is marked addressed in d74fe57 and its thread is resolved; no further code change is needed. |
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
The current CodSpeed comparison is not representative because the benchmark fixture reuses an already-finished parser across measured iterations. I opened #318 to create and finalize a fresh parser per benchmark invocation. PR #317 should be rebased and evaluated again after #318 merges; the corrected baseline will provide a meaningful performance comparison. |
c83a120 to
d74fe57
Compare
Summary
Nonemultipart callbacks to shared no-op functions once during parser initializationset_callback()BaseParser.callback()for every eventPerformance
CodSpeed reports a 24.15% efficiency improvement for the corrected 100-field complete-parse benchmark, from 3.7 ms to 3.0 ms. The other four corrected benchmarks are unchanged. CodSpeed notes that the compared runs used different runtime environments, so the same-environment local results below provide additional context.
Same-environment local wall-time benchmarks on Python 3.13:
A Starlette-shaped 100-field multipart parse improved from approximately 661 µs to 616 µs (about 6.8%).
Validation