You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
avoid regex-based header field parsing in Dicer's HeaderParser
scan CRLF-delimited header lines directly instead of using buffer.split(/\r\n/g)
preserve folded-header handling and existing malformed-header behavior
Performance
Local HeaderParser microbenchmark on a 3-header block:
before: ~1.78M ops/sec
after: ~2.66M ops/sec
A local @platformatic/flame run also confirmed HeaderParser._parseHeader remains a primary hotspot, but its self-time dropped in the targeted multipart workload.
Added a follow-up optimization in 6d81635: HeaderParser now scans for the header terminator directly instead of routing header parsing through StreamSearch. I also added coverage for CRLFCRLF split across chunks, including after maxHeaderSize is reached.\n\nValidation:\n- npm test\n- npm run lint\n- npm run bench:dicer\n- remote CI checks are passing.
Added another follow-up optimization in 978c38d, based on a full Busboy multipart flamegraph (Busboy -> Multipart -> Dicer -> HeaderParser), not just the Dicer micro/profile path.\n\nFull-profile result on the local multipart workload:\n- before this follow-up: 7,794 parses / 7s baseline from the full Busboy flamegraph\n- after HeaderParser direct scan: 8,610 parses / 7s\n- after parse/decode fast paths: 10,397 parses / 7s\n\nChanges in the latest commit:\n- skip Buffer/TextDecoder-style UTF-8 decoding for ASCII strings\n- add fast paths for common form-data; name=...; filename=... parsing\n- avoid parseParams() for simple per-part content-type values without parameters\n\nFinal full flamegraph artifacts are local at:\n- /tmp/busboy-full-flame-final/cpu-profile-2026-05-23T10-15-52-214Z.html\n- /tmp/busboy-full-flame-final/cpu-profile-2026-05-23T10-15-52-214Z.md\n\nValidation:\n- npm test\n- npm run lint\n- remote CI checks are passing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HeaderParserbuffer.split(/\r\n/g)Performance
Local HeaderParser microbenchmark on a 3-header block:
A local
@platformatic/flamerun also confirmedHeaderParser._parseHeaderremains a primary hotspot, but its self-time dropped in the targeted multipart workload.Validation
npm testnpm run lint