I Pitted Bun Against Rust—And Bun’s Health Bar Was Gone in Seconds…

Let me tell you, in our programmer circles, there are always a few topics that spark endless debates. Like “Is PHP the best language?” Or, today’s main event: The new JavaScript hotshot Bun vs the performance veteran Rust—who’s really faster?

Talk is cheap. Most people would say, “Isn’t it obvious? Rust, of course!”

True, but I was genuinely curious—how much faster? Just a little, or is it a total blowout? So, I set up a head-to-head match to find out.

The result? Let’s just say, it was… brutal.

Meet the Contenders

  • Red Corner: Bun (with Elysia framework)

    • Think of Bun as the hottest new star in the JS world—great developer experience, packed with tools, and claims blazing speed. It punches Node.js, kicks Deno, and is the darling of many frontend and fullstack devs.
  • Blue Corner: Rust (with Actix framework)

    • No newcomer here—Rust is the heavyweight champ of performance. No frills, just raw power: stable, precise, and ruthless. In Rust’s dictionary, there’s no such thing as “memory leak” or “performance compromise.” It’s the king of system-level and low-level development.

The Rules: Benchmark or Bust!

To keep things fair, I gave them the same task: build a URL shortener service. This is a great test for backend frameworks, because when the requests start flying, you quickly see who’s really swimming naked.

Test environment: my M4 MacBook Air, with PostgreSQL as the database.

I unleashed 10, 50, even 100 virtual users hammering both services at once—let’s see who cracks first.

The Results: This Wasn’t a Fight, It Was a Beatdown!

First up: “Punch Speed” (Throughput RPS)

In plain terms: how many requests per second can you handle?

When 100 users hit at once, the numbers shocked me:

  • Bun/Elysia: 14,295 RPS
  • Rust/Actix: 143,514 RPS

You read that right—no decimal error. Rust’s punch speed is 10x that of Bun!

Bun was left gasping for air, while Rust barely broke a sweat—might as well have lit a cigarette. Bun’s health bar? Basically empty.

RPS Chart

Next: “Reaction Speed” (Latency)

This one’s even more critical—it determines your user experience.

It’s like clicking a button: Rust responds instantly, with P99 latency at just 11.97 ms—you won’t even notice a delay.

Bun? Under heavy load, it starts to lag, with P99 latency hitting 111.95 ms. That’s a delay users will definitely feel—like your internet just stuttered. For apps chasing a silky-smooth experience, that’s a big deal. Latency Chart

So, Should We Just Ditch Bun?

Not so fast! Tech is never black and white.

Rust is fast—crazy fast. But its learning curve is just as steep. Writing good Rust will cost you some hair.

It’s like this: if you’re just popping downstairs for a bottle of water, you wouldn’t take an F1 car, right? Sure, it’s fast, but by the time you’ve started it up, the guy on a shared bike is already home gaming.

The real lesson here: “Use the right tool for the job.”

  • When to use Bun?

    • When you need to ship fast! For startups, MVPs, rapid feature iteration—Bun and the whole JS ecosystem will make you fly. High dev efficiency, huge community, and solutions for every problem. For most scenarios, its performance is more than enough.
  • When do you need Rust?

    • When your project is mission critical—core business, trading systems, payment gateways, or anything expecting insane traffic. Here, sacrificing some dev speed gets you ultimate performance, rock-solid stability, and peace of mind at night.

In short:

Bun is for moving fast today; Rust is for sleeping well tomorrow.

Want more tech deep-dives in plain English? Stick around!

Follow Mengshou Coding on WeChat for more cutting-edge content.


Reference: URL shortener service benchmarking: Bun (Elysia) vs Rust (Actix)