DEV Community

ke jia
ke jia

Posted on

I Timed My Own Template: Where the 3 Seconds Actually Go

"Generate a project in 3 seconds" is the kind of claim that's easy to make and hard to verify. So I did the verification: I timed my own scaffolder, scaffoldx-cli, on each of its templates, and broke down where the time actually goes.

This is a post about my own tool, so take the numbers with the obvious grain. But the breakdown is useful regardless, because it applies to any "fast" CLI claim you encounter.

The setup

time npx scaffoldx-cli   # interactive: pick template, enter name
Enter fullscreen mode Exit fullscreen mode

Machine: a mid-range laptop, Node 22, warm npx cache (the first run downloads the package; I'm measuring the generate step, not the download). Nine templates, five runs each, median reported.

The medians

Template Median Range
React + Vite + Tailwind 2.8s 2.4–3.5s
Next.js App Router 3.1s 2.7–3.9s
Express REST API 2.2s 1.9–2.8s
Chrome Extension 1.8s 1.6–2.1s
Node.js CLI Tool 1.7s 1.5–2.0s
Landing Page 1.2s 1.0–1.5s
FastAPI 1.9s 1.6–2.4s
Discord Bot 1.8s 1.6–2.2s
Electron 3.4s 3.0–4.2s

The "3 seconds" claim is accurate for the front-end templates and generous for the back-end ones. The honest number is 1.2 to 3.4 seconds depending on how many files the template emits.

Where the time goes

This is the part that generalizes. I profiled the generate step and the breakdown was:

1. npx resolution: ~0.3s (warm cache). The cost of "is the package in my cache, and which version?" Cold cache adds a few seconds of download — that's a one-time cost per machine, not a per-run cost. If a "3 second" CLI claim includes a cold npx, that's the number to question.

2. Template expansion: ~0.1s. The scaffolder is a single zero-dependency Node file; "expansion" is string templating and fs.writeFile calls. This is the part people assume is expensive, and it isn't. Even the Electron template, which writes the most files, spends under a tenth of a second here.

3. git init + first commit: ~0.8s. The single biggest cost in the whole pipeline. git init is fast; the first commit is the slow part, because git writes the object store, updates the index, and runs any configured hooks. This is the tax on the "version-controlled from second zero" feature — and I'd pay it again.

4. Interactive prompt wait: user time, not tool time. The median includes the ~0.5s it takes a human to type a project name. The tool's own wall-clock time is lower than the table suggests.

What this means for evaluating any "fast" CLI

When a tool claims a speed number, the number is a sum of at least four things, and only one of them is the tool's actual work:

  1. Package resolution (npx, pipx, brew lookup) — cache-dependent, often the dominant term on cold runs.
  2. The actual work (file writes, codegen, compilation) — usually the smallest term, and the only one that reflects the tool's design.
  3. Subprocess taxes (git init, npm install, build steps) — often the second-largest term, and often the part the tool is choosing to pay for a feature.
  4. Human time (prompts, confirmations) — included in "wall clock" but not in "tool time."

A fair speed claim separates these. "Generates in 3 seconds" is ambiguous; "writes 40 files in 0.1s, git init adds 0.8s, total wall clock 2.8s on a warm cache" is checkable.

The honest takeaway

My tool isn't magically fast. It's fast because the actual work (template expansion) is trivially cheap — a single file doing string replacement and writes — and the rest of the time is the price of the features it pays for (git init, a complete .gitignore, a first commit).

The "3 seconds" is real, and it's mostly the git tax. If you're building a CLI and someone asks "how fast?", give them the breakdown, not the headline. The breakdown is where the design decisions are visible — and the design decisions are the part that actually matters.

time npx scaffoldx-cli
Enter fullscreen mode Exit fullscreen mode

More Tools

Tool What it does Command
scaffoldx-cli Production-ready project templates in seconds npx scaffoldx-cli
dotguard Scan .env files for exposed secrets npx @wuchunjie/dotguard
gitpulse Git repo analytics in your terminal npx @wuchunjie/gitpulse
snippetx Terminal code snippet manager npx @wuchunjie/snippetx

If these save you time, consider buying me a coffee. All tools are MIT-licensed, zero-dependency, and run fully offline.

Top comments (0)