Skip to content

cli with --secure and --fast - #1040

Merged
motdotla merged 6 commits into
masterfrom
cli
Jul 31, 2026
Merged

cli with --secure and --fast#1040
motdotla merged 6 commits into
masterfrom
cli

Conversation

@motdotla

Copy link
Copy Markdown
Owner

No description provided.

homanp and others added 4 commits April 15, 2026 19:32
Reproduces with: node tests/test-parse-perf.js
Reports median of 7 runs of 5000 parse() calls on a 200-line .env.
The line-matching regex in parse() is the dominant cost when parsing
large .env files. Replaces it with a Uint8Array(256) lookup table for
key character classification and a manual state machine over the
input string. indexOf() is used to find the end of unquoted values
and newline boundaries.

Behavior is preserved across the existing test suite and 24 additional
edge cases (escaped quotes inside double quotes, unterminated quotes,
yaml-style 'KEY: value', export prefix, multiline values, inline
comments, KEY==value, etc.).

No new dependencies. No changes to public API.
motdotla and others added 2 commits July 30, 2026 18:23
perf: ~2x faster parse() via hand-written character scanner

Keep the classic regex parser as default and expose #1010's scanner
behind parse(src, { fast: true }) / config({ fast: true }).

Co-authored-by: Cursor <cursoragent@cursor.com>
@motdotla motdotla changed the title cli with --secure cli with --secure and --fast Jul 31, 2026
@motdotla
motdotla merged commit c0e32b8 into master Jul 31, 2026
4 checks passed
@motdotla
motdotla deleted the cli branch July 31, 2026 14:39
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.

2 participants