Skip to content

Optimizations for heap usage and module decomposition#25

Merged
szeka9 merged 4 commits into
mainfrom
development
Jun 27, 2026
Merged

Optimizations for heap usage and module decomposition#25
szeka9 merged 4 commits into
mainfrom
development

Conversation

@szeka9

@szeka9 szeka9 commented Jun 27, 2026

Copy link
Copy Markdown
Owner

No description provided.

szeka9 added 4 commits June 27, 2026 14:59
Running the state machine loop with a generator
does not provide any advantage, and increases heap
usage.

This change simplifies the state machine loop by
removing the yield statement. This way, the calling side
needs to handle each invocation of `run()` as
a separate state transition.
Improve HTTP/MIME header parsing by avoiding
temporary allocations. Instead, iterate over
headers once, parsing and validating fields
directly in the provided memoryview object.

Move multipart header/body parsing to the multipart
module, reducing the memory footprint of the
core HTTP parser.
Remove `_unset_response_handler` and centralize
cleanup logic to be invoked through set_response_body().
This change reduces the memory footprint because of the
removed function definition, as well as simplifies
the internal response handling logic.
Move helpers for adding functions and properties to
classes to a separate module. This improves the baseline
memory footprint because these helpers are only used
by the multipart parser module, enabled conditionally.
@szeka9 szeka9 merged commit 64075d9 into main Jun 27, 2026
1 check passed
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