Banning phones raises grades. What does Bun have to do with it?
Schools that took phones out of the classroom are seeing grades go up. No miracle jump. It's a small improvement that grows every year. The new data comes from The Upshot, at The New York Times. It looks like education news, and it is. But I read it thinking about my terminal, and about Bun, and I'll explain why.
What the study on phones in schools found
The idea is simple. Several American schools and states banned phones during class. Now it's possible to compare before and after using standardized test data.
The result isn't an overnight turnaround. It's gradual. In the first year the effect is modest. Over time, the difference shows up. Students start staying on a task longer without being pulled away from it.
That "gradual" part is what interests me. Nobody gets smarter because they put their phone down. What changes is that they stop being interrupted all the time. And being interrupted less, added up over months, turns into results.
Why this matters for people who code
Programming is the activity that suffers most from interruptions. You build a model of the system in your head: who calls whom, which state lives where, why that test breaks. That model is fragile. A single notification can knock it all down.
Researcher Gloria Mark, from the University of California, Irvine, became known for measuring this. In her studies, a person who gets interrupted takes about 23 minutes on average to truly get back to the original task. Twenty-three minutes. Because of a group chat message.
Now the uncomfortable part. Many of a dev's interruptions don't come from outside. They come from us, and the trigger is a slow tool.
You know the script:
- You run
npm install. - The progress bar starts crawling.
- You grab your phone "just for a minute".
- You come back 12 minutes later with no idea what you were about to test.
The install finished in 40 seconds. You're the one who didn't come back.
Short waits are the most dangerous: long enough for you to leave, too short for you to notice you left.
Where Bun comes into the story
Schools took the phone out of the room. We're not going to lock our phones in a drawer (sometimes we should). But we can close the gaps that lead to it. And the biggest gap in a JavaScript dev's workflow is waiting on tools.
Bun was built to be fast. It bundles a runtime, package manager, test runner and bundler into a single binary. In practice, that means fewer waits in four places:
- Installing dependencies.
bun installuses a global cache and filesystem links. On a project with a warm cache, it usually finishes before you even think about grabbing your phone. - Running TypeScript. Bun runs
.tsdirectly, with no compile step and nots-node. - Running tests.
bun teststarts very fast and supports most of the Jest API. - Starting the dev server.
--watchrestarts the process almost without you noticing.
None of these gains is impressive on its own. Two seconds here, five there. The effect comes from adding them up, just like in the study. Every wait that disappears is one less chance to leave the task.
How to replace the waits in your workflow with Bun
You don't need to migrate the whole project at once. You can start with what hurts most. Here's the path I follow.
First, the package manager. It works with the package.json you already have:
# install everything from the existing package.json
bun install
# add a dependency
bun add zod
# dev dependency
bun add -d @types/node
Next, the scripts. bun run executes the same scripts from package.json, and it boots much lighter than npm run:
{
"scripts": {
"dev": "bun --watch src/index.ts",
"test": "bun test",
"test:watch": "bun test --watch"
}
}
Look at dev. There's no tsc, nodemon or ts-node. Bun reads the TypeScript, watches the files and restarts on its own.
For tests, the syntax is the one you already know:
import { describe, expect, test } from "bun:test";
import { calculateDiscount } from "./price";
describe("calculateDiscount", () => {
test("applies 10% above 100", () => {
expect(calculateDiscount(200)).toBe(180);
});
test("gives no discount below the minimum", () => {
expect(calculateDiscount(50)).toBe(50);
});
});
With bun test --watch open in a terminal next to you, the loop looks like this: you save, glance to the right and already have the answer. There's no time left to open Instagram. That's the goal.
A tip: start with tests. They're usually the most frequent wait of the day and the smoothest migration. If a test depends on a Jest-specific API that Bun doesn't cover yet, you'll find out right away and can decide whether it's worth adjusting.
What Bun doesn't fix
Now the honest part, because I don't want this to turn into an ad.
A fast tool doesn't fix a slow process. If your CI takes 25 minutes because it runs a giant E2E suite on every push, switching runtimes barely changes anything. The bottleneck is somewhere else.
Compatibility still has rough edges. Bun covers most of the Node APIs, but there's always a package with a native binding or a dependency that touches some internal detail and behaves differently. On a large, older project, test before promising the team a migration.
You're still you. If the install finishes in one second and you grab your phone anyway, the install wasn't the problem. Schools didn't make students more disciplined. They removed the object from in front of them. A fast tool does the same: it removes the excuse. The decision is still yours.
There's also a point few people mention: too much speed can turn into anxiety. Tests running on every keystroke, the server restarting all the time, the terminal flashing. Fast feedback helps when you control the pace. If it got noisy, run watch only on the file you're working on:
bun test price.test.ts --watch
What I take from this news
The school study shows something every dev feels firsthand: what matters most is how long you stay truly focused, and talent alone counts less than it seems. And that time gets destroyed by small escapes that look harmless.
My opinion, plainly: your tools' wait time is a productivity cost, and most teams ignore it. Nobody writes in the retro that "we lost focus because the install takes 50 seconds". But we do. Every day, several times.
Bun isn't the only answer. pnpm, Vite, esbuild and recent versions of Node itself have also cut a lot of waiting in recent years. But if you work with TypeScript and still have ts-node and nodemon in your package.json, it's worth an afternoon of testing. At worst, you find out where your waits are. At best, you win back a few minutes of focus a day, and over time they make a difference, just like in the schools.
And if your phone is sitting next to your keyboard right now, maybe the first optimization isn't in the code.
If you want to see where I use Bun day to day, there are some examples in my projects.
LinkedIn summary
Schools that banned phones are seeing grades go up. And I read the news thinking about my terminal. The improvement doesn't happen overnight. It grows slowly, year after year, because students simply stop getting interrupted. It's the same for devs. You run the install, the progress bar crawls, you grab your phone "just for a minute" and come back 12 minutes later with no idea what you were about to test. The install finished in 40 seconds. You were the one who took long to come back. That's why I treat tool wait time as a productivity cost. It was one of the reasons I adopted Bun: fast installs, TypeScript without compiling, tests in watch mode. Every wait that disappears is one less excuse to leave the task. A fast tool doesn't work miracles and doesn't replace discipline. But it takes the phone out of reach. I wrote about it on the blog, with a step-by-step migration guide. Which waits pull you out of focus the most? #Bun #JavaScript #TypeScript #Productivity #SoftwareDevelopment