bun fmt vs Prettier 3.10: 697 TypeScript Files, Identical Output, 45x Faster
The 60-second version of this test. Subscribe on YouTube
Bun 1.4.4 came out on October 22 with a new command: bun fmt. The release notes call it a Prettier-compatible formatter that reads your existing .prettierrc, and they claim it matches 9,648 of Prettier’s 9,731 formatting tests. They also claim it formats Prettier’s own repository in 59.7 ms, against 17.1 seconds for Prettier itself.
Prettier 3.10.1 shipped yesterday, so the question is fresh: can you delete Prettier from devDependencies and run bun fmt instead, without a single line of your code changing? A formatter that’s fast but formats differently is a 700-file diff and a broken git blame. Speed only matters if the output is the same.
So I ran both on the same real TypeScript codebase, compared the output byte for byte, and timed them.
The Setup
- Machine: a 4 vCPU cloud container (Intel Xeon @ 2.10 GHz, 15 GB RAM).
- Prettier side:
[email protected](published November 12, 2026), installed with npm, run on Node.js 22.23.4 by callingprettier.cjsdirectly, with nonpxwrapper. - Bun side: Bun 1.4.4 (
1.4.4+38afee6c8), which is the first Bun line written in Rust.bun fmtis built in, so there’s nothing to install. - The code: every
.tsand.tsxfile underpackages/in TanStack Query at commit36dd792. That’s 697 files and 201,325 lines, 8 MB of real library code: React, Vue, Solid, Svelte and Angular adapters, types-heavy core, tests. I copied the files into a clean folder so neither tool could pick up the project’s own config. - Method: each run starts from a fresh copy of the folder. One warm-up run is thrown away, then 5 measured runs. I report the median wall-clock time and the peak memory (max RSS) of the formatter process, read from
os.wait4()in a small Python harness.
Here’s the harness, trimmed to what matters:
import os, sys, time, subprocess, shutil, statistics
base, runs, cmd = sys.argv[1], 5, sys.argv[2:]
results = []
for i in range(runs + 1): # run 0 is a warm-up, discarded
work = base + ".run"
shutil.rmtree(work, ignore_errors=True)
shutil.copytree(base, work) # every run formats the same unformatted tree
t0 = time.perf_counter()
p = subprocess.Popen(cmd, cwd=work, stdout=subprocess.DEVNULL)
_, status, usage = os.wait4(p.pid, 0)
if i:
results.append((time.perf_counter() - t0, usage.ru_maxrss / 1024))
print(statistics.median(t for t, _ in results), "s",
statistics.median(m for _, m in results), "MB")
And the two commands it ran:
# Prettier 3.10.1 on Node 22
node node_modules/prettier/bin/prettier.cjs --write "**/*.{ts,tsx}" --log-level warn
# Bun 1.4.4
bun fmt .
Round 1: Is the Output the Same?
This is the round that decides whether the rest matters.
TanStack Query is formatted with oxfmt and its own style (no semicolons, single quotes), so running either tool with default options rewrites almost everything. Prettier changed 696 of the 697 files. bun fmt changed the same 696. Then I diffed the two output folders:
$ diff -rq prettier-output/ bun-output/ | wc -l
0
Zero files differ. 697 files, byte for byte identical.
Defaults are the easy case, so I ran it again with a .prettierrc.json matching the project’s style, dropped into both folders:
{ "semi": false, "singleQuote": true, "trailingComma": "all", "printWidth": 80 }
bun fmt picked it up without any flag (bun fmt --doctor prints Using .prettierrc.json (Prettier config) and 698 files are formatted natively). This time both tools changed the same 57 files, and once again the TypeScript output was identical across all 697 files.
One small difference showed up, and it isn’t in the TypeScript: bun fmt . also reformatted the .prettierrc.json itself, because it formats JSON by default. My Prettier command only targeted *.{ts,tsx}. If you switch, expect bun fmt . to touch JSON, YAML and Markdown files that your old Prettier glob may have skipped.
Round 2: Formatting the Whole Repo
Then the timings. “Write” means formatting the unformatted copy in place.
--write, 697 files | Median time | Peak memory |
|---|---|---|
| Prettier 3.10.1 (Node 22) | 14.02 s | 327 MB |
bun fmt, all 4 cores | 0.094 s | 42 MB |
bun fmt, pinned to 1 core | 0.312 s | 30 MB |
The 4-core number is about 149x faster than Prettier. That’s not a fair fight, though: bun fmt spreads files across every core, while the Prettier CLI formats them in one Node.js process. On a separate run, Prettier used 27.4 seconds of CPU time over 13.8 seconds of wall-clock time, so about 2 cores’ worth. So I also pinned Bun to a single core with taskset -c 0 bun fmt .. On one core it’s still 45x faster than Prettier using about two, with less than a tenth of the memory.
Round 3: The CI Check
In CI you don’t write, you check. This round runs on a folder that’s already formatted, which is what a passing CI job sees.
--check, already formatted | Median time | Peak memory |
|---|---|---|
Prettier 3.10.1 --check | 13.51 s | 313 MB |
Prettier 3.10.1 --check --cache, second run | about 1.5 s | not measured |
bun fmt --check, all 4 cores | 0.062 s | 41 MB |
bun fmt --check, pinned to 1 core | 0.196 s | 31 MB |
Prettier’s --cache flag is its real answer to this: on a second run with nothing changed it skips every file, and it took between 1.43 and 1.54 seconds over 3 runs (timed with date, not the harness). That’s about 9x better than an uncached check. But a cold CI runner doesn’t have that cache unless you save and restore it, and even when it does, bun fmt --check with no cache at all still finishes first.
The Comparison
| Prettier 3.10.1 | bun fmt (Bun 1.4.4) | |
|---|---|---|
| Output on 697 TS files | Reference | Identical, defaults and custom config |
| Write, 697 files | 14.02 s | 0.094 s (0.312 s on 1 core) |
| Check, 697 files | 13.51 s (about 1.5 s with a warm --cache) | 0.062 s (0.196 s on 1 core) |
| Peak memory | 313 to 327 MB | 30 to 42 MB |
| Install | npm package (12 MB in node_modules), runs on Node | Built into Bun (the bun binary is 107 MB) |
| Config | .prettierrc, package.json key, JS configs | bunfig.toml, and reads .prettierrc, .oxfmtrc.json, .editorconfig |
| Plugins | Any Prettier plugin | Tailwind and package.json sorting built in; Astro files are sent to your installed Prettier (docs) |
| Prettier test suite | 100%, by definition | 9,648 of 9,731 tests (99.1%), per Bun’s release notes |
| Age | Since 2017 | Shipped October 22, 2026 |
Where bun fmt Wins
Anywhere a human is waiting. A pre-commit hook, a CI check, a “format on save” that touches many files. 14 seconds is long enough to break flow; 0.1 seconds isn’t noticeable. bun fmt --staged also replaces the lint-staged + Prettier combination for pre-commit hooks, according to the release notes.
Teams already on Bun. If bun is already your runtime or package manager, the formatter costs you nothing to install and removes a dependency. On this codebase it produced the same bytes as Prettier, so the switch is a one-line change in package.json and no reformatting commit.
Memory-limited CI runners. About 40 MB instead of about 320 MB for the same job.
Where Prettier Wins
Plugins. If your .prettierrc lists a plugin Bun doesn’t know, Bun’s documentation doesn’t say what happens, except for Astro, where it hands the files back to your installed Prettier. Teams with custom or niche plugins should keep Prettier, or at least run bun fmt --doctor first.
The 0.9%. Bun’s own numbers say 83 of Prettier’s formatting tests produce different output. My 697 files didn’t hit any of them, but your code might. Some of those differences are deliberate, where Bun says Prettier’s output would change what the code means.
Not every team runs Bun. If your stack is Node and npm, adopting a 107 MB runtime only for its formatter is a real cost for contributors and Docker images. Prettier also works as a library inside editors and other tools, which a CLI command doesn’t replace.
Maturity. bun fmt is three weeks old. Prettier has nine years of edge cases behind it.
Decision Table
| Your situation | Pick |
|---|---|
| Already use Bun, standard Prettier config, no exotic plugins | bun fmt |
| Slow pre-commit hook or CI format check | bun fmt, after a diff like the one above on your own repo |
Node-only team, formatting is “fast enough” with --cache | Prettier |
| Custom Prettier plugins | Prettier, until bun fmt --doctor says it can handle them |
| Want to switch without risk | Run both on a copy of your repo and diff -rq the outputs, like I did |
The Verdict
bun fmt wins this clash. On 697 real TypeScript files from TanStack Query, it produced exactly the same output as Prettier 3.10.1, with the default options and with a custom config, and it did it 45x faster on one core and 149x faster on four, using about a tenth of the memory.
The “drop-in” claim held on this codebase, and that’s the part that surprised me more than the speed. Speed was always going to favor native code. Matching Prettier’s output byte for byte, three weeks after release, is the hard part.
Caveats: one codebase, TypeScript only, one 4-core machine. I didn’t test CSS, Markdown, Vue SFCs or plugins, which is exactly where Bun says the 0.9% of differences lives. Before switching, copy your repo, run both formatters, and diff the folders. It takes less than a minute, and most of that is Prettier.
Related Articles
More TypeScript tooling clashes:
- Vitest 5 vs Jest 30: Jest Won My Benchmark Until I Changed One Flag — The same “same code, both tools, median of five” method, applied to test runners.
- Biome vs Oxlint: I Benchmarked Both — And the Winner Depends on Your Team — Another native-code tool against the JavaScript incumbent.
- Why I Stopped Using ESLint for TypeScript — And Started Using Biome — What happens when you cut a toolchain down to fewer packages.
Enjoying the content? Here are tools I personally use and recommend:
- 🌐 Hosting: Bluehost — simple hosting for a WordPress or PHP site
- 🛒 Tech Gear: My Amazon Store — keyboards, monitors, dev tools I use
Purchases through my links help keep this blog ad-free 💙
Enjoyed this post?
Every clash gets a video: two tools, one real task, a measured winner.
▶ Subscribe on YouTube 🎬 All videos