Skip to content

feat: Added @perseveranza-pets/milo as alternative experimental HTTP parser#5492

Open
ShogunPanda wants to merge 1 commit into
nodejs:mainfrom
ShogunPanda:milo
Open

feat: Added @perseveranza-pets/milo as alternative experimental HTTP parser#5492
ShogunPanda wants to merge 1 commit into
nodejs:mainfrom
ShogunPanda:milo

Conversation

@ShogunPanda

Copy link
Copy Markdown
Contributor

Summary

  • Added an opt-in Milo-backed HTTP/1 parser, enabled with UNDICI_USE_MILO=1 or UNDICI_USE_MILO=true.
  • Vendored Milo CJS artifacts, including SIMD and non-SIMD WebAssembly builds, plus a build:milo script to refresh them.
  • Integrated Milo into the HTTP/1 client parser selection while preserving the existing llhttp parser as the default.
  • Updated benchmarks and tests for the new parser callback flow and Milo’s stricter RFC 9112 parsing behavior.

Assisted-By: OpenAI:GPT-5.5 <openai/gpt-5.5>

Status

…parser.

Signed-off-by: Paolo Insogna <paolo@cowtech.it>
@ShogunPanda ShogunPanda requested a review from mcollina July 2, 2026 15:15
@ronag

ronag commented Jul 2, 2026

Copy link
Copy Markdown
Member

Perf comparison?

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 12.30509% with 4668 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.27%. Comparing base (838b6cd) to head (6bfe2bd).

Files with missing lines Patch % Lines
lib/milo/src/no-simd/index.js 0.00% 1087 Missing ⚠️
lib/milo/src/no-simd/unbundled.js 0.00% 1085 Missing ⚠️
lib/milo/src/simd/unbundled.js 0.00% 1085 Missing ⚠️
lib/dispatcher/parser-h1.js 13.36% 810 Missing ⚠️
lib/milo/src/simd/index.js 44.80% 600 Missing ⚠️
lib/dispatcher/client-h1.js 97.72% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5492       +/-   ##
===========================================
- Coverage   93.43%   83.27%   -10.16%     
===========================================
  Files         110      115        +5     
  Lines       37278    42536     +5258     
===========================================
+ Hits        34829    35421      +592     
- Misses       2449     7115     +4666     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ShogunPanda

Copy link
Copy Markdown
Contributor Author

Perf comparison?

I haven't posted them here but even thought Milo is twice as fast as llhttp in terms of pure WASM perf, undici benchmark varies from +3% to -1% on different runs. I've tried countless times.
The interesting thing is that Milo has an optimization which can suspend the parser after the headers and I have this in the H1Parser so body parsing can be skipped when the Content-Length is present. This would help performance in big payloads.

@metcoder95 metcoder95 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I like this, a env var seems a good option as well to switch between experiences; but maybe adding it within a Client constructor can be helpful.

@ShogunPanda

Copy link
Copy Markdown
Contributor Author

I like this, a env var seems a good option as well to switch between experiences; but maybe adding it within a Client constructor can be helpful.

Do you mind to expand. I'm not sure I get what you're asking for.

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.

4 participants