Skip to content

Two small parser speedups (1.16x to 1.35x on the benchmark forms) #365

Closed as not planned

Description

@deadstrobe5

Two small changes make form parsing 1.16x to 1.35x faster on the cases in tests/test_benchmarks.py, with the parsed output unchanged. Opening a PR is not possible from my account right now, so here they are as branches:

Change Case Before After
Skip the byte-by-byte CRLF steps in MultipartParser when the line ending is in the buffer LARGE_FORM, append callbacks 839 us 689 us
SIMPLE_FORM, append callbacks 32.3 us 27.1 us
Start the next field right after & in QuerystringParser URLENCODED_LARGE, no-op callbacks 99.8 us 73.3 us
URLENCODED_LARGE, append callbacks 135 us 109 us

Large file uploads (8 MB in 64 KB chunks) and tiny bodies like a=1 are unchanged. Old and new parsers gave the same callbacks on randomised bodies split into random chunks. Made with Claude Code (Claude Opus 5.5). Happy to open PRs if you want them.

Activity

  1. Kludex commented on Nov 16, 2026

    @Kludex
    Owner

    Thanks for the proposal. The query-string optimization was merged in #372. We are closing this issue without taking the separate multipart CRLF fast paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions