Faster than Node's native parseEnv?

Scott Motte ·

Faster than Node's native parseEnv?

No, way.

Yes. Yes, way.

Dotenv's fast mode now beats Node's native parser on all current LTS versions - Node 22 and 24 - across Linux and Windows in our benchmarks. See below where Node native is still faster.

Background

Five months ago, the wildest PR ever landed in dotenv. Dotenv contributions are typically small parser changes, type detail additions, or proposals for all new features. This was something different.

This was a new parser, claiming 2x speedup.

Pull request introducing the faster dotenv parser

Some guy from Sweden, homanp. A character scanning approach. Pretty sick, tbh.

So what did I do? What any maintainer does for a package depended on by tens of millions. I sat on it. lol.

But we also got in touch with each other and had a chat. He and his cofounder ran a service called Superagent.sh - securing PRs. They generously offered to secure Dotenvx's, and today they do that for all kinds of open source projects - even Firecrawl.

The Release

Back to Dotenv. The parser was contributed as a full replacement. That's too risky so we put it behind the --fast flag. On September 17th, five months after that initial PR dropped, we released it.

Dotenv changelog announcing the fast parser

It's fast.

Node Linux Windows
20 Native wins Native wins
22 LTS Dotenv wins Dotenv wins
24 LTS Dotenv wins Dotenv wins
26 Current Native wins Dotenv wins Buffers; strings tied

Source: GitHub Actions benchmarks, September 23, 2026.

Since then the community is using it, have found edge cases, and those have been patched. It's cool to see, and I won't be surprised if it becomes adopted by other dotenv implementations.

Usage

With dotenv 18 or later, enable fast mode in your app:

require('dotenv').config({ fast: true })

Or use the new CLI:

$ npx dotenv run --fast -- node index.js

Dotenv fast mode in action.

The Future

Software is changing, fast. With Dotenv we're committed to maintaining the past while still evolving .env. This --fast parser is an example of that.

If you love .env and also want to see it evolve, please support us. Use dotenv, use dotenvx, and even snag a dotenv membership. Be part of the .env story. It's not all written yet.

Lastly, a giant thank you to Superagent.sh for bringing this to the dotenv community.