DEV Community

Cover image for Bun: The Next Big Thing in Javascript

Bun: The Next Big Thing in Javascript

Kinanee Samson on September 12, 2023

Bun is a Javascript runtime that claims to be 4x faster than NodeJS. Bun is an all-in-one Javascript runtime & toolkit. Bun ships as a single e...
Collapse
 
jemh profile image
Jem • Edited

I find it very funny that, at v1.0, it does not run on Windows. What is going on in their minds? It's just weird.
I don't care about the OS war, use whatever floats your boat, but you can't ignore that Windows has the largest desktop market share. If you aim at something solid and popular, how can you not support it?

Collapse
 
natescode profile image
Nathan Hedglin
  1. Scope
  2. Do you target the server OS or the developer OS first? Linux is what basically everyone deploys to do support for POSIX systems first.

Yeah I hope they make windows a priority.

Collapse
 
kalashin1 profile image
Kinanee Samson

Yeah I do hope too. You don't only target server OS developer OS is also very important because who will be developing the apps to run on the server?

Thread Thread
 
natescode profile image
Nathan Hedglin

Exactly. We'll see 😊

Thread Thread
 
nerdydeedsllc profile image
Nerdy Deeds, LLC • Edited

Not to put too fine a point on it, they're hedging their bets.

In 2023, in a survey of over 87,000 developers, Windows use for personal use has fallen to 59.72% (down from 62.33% just last year), and clear down to 46.91% (down from 48.82%) for professional use. The rest being almost unilaterally (99.3%) MacOS and some flavor of Linux. Let that sink in. MORE THAN HALF of the surveyed professional developers are using a non-Windows platform. Go ahead and lump in the 15.68% of the windows developers who DO use WSL and now we're teetering JUST below 66%.

2 out of 3. Developers. Do. Not. Use. Windows. For. Development.

So it's not even that they're "targeting server OS". They're targeting the majority.

"But I don't wanna learn WSL!"

I get it. It's clunky and slow. But speaking as a 28-year veteran web software engineer, I have some bad news for you if you choose to stay in this field: you will have to totally re-learn your job every 5 year or so, on average. I've had to six times now. Things are moving too fast to do otherwise.

"But I don't wanna run Linux/dual boot my machine!"

I understand that too (though I'm typing this on my server dev box... running Ubuntu, sitting next to my company-issued MBP, and over the M2 Pro Mac Mini mounted to the underside of my desk). Indeed: using Linux is not dissimilar to punching yourself in the nuts: it hurts, it take real willpower to keep doing it, and it's typically not necessary for the average guy... but hey: it's free.

That said, allow me to introduce you to a third option: Get. A. Mac.

"But I don't wanna learn a new OS! Besides Macs are too expensive!"

I can respect the hesitation, though you're only half right about the second point: Good Macs are expensive. But if it's only cost that makes you twitchy about learning a new OS, slightly-older or even a lower-powered contemporary machines are windows-comparable, cost-wise (I paid 600 for my M1 Mini the month they came out). Besides: cost of doing business. If you're working in the field? You can afford it; it's considered "professional development", and you can even write it off. If you're still learning? Well, statistical trends suggest that's the way things are headed, and better to learn now than try to on the job.

And if ALL THAT doesn't clench it for you? If the idea of moving away from what is arguably the worst development environment available on the market today because it's too scary/hard/expensive/time-consuming?
FINE. Windows support is supposed to land on Monday, Nov. 13, 2023. Wimp.

Thread Thread
 
natescode profile image
Nathan Hedglin

Great thanks for adding the detail! I didn't realize non-Windows had grown that much! I knew it had grown.

Collapse
 
jfftck profile image
jfftck

The majority of developers use Linux or Docker with a Linux container, why would you need Windows support for those environments? Plus, if you understand how it is doing things under the hood to get the faster performance, you would realize that it is using features from Unix(-like) environments and that is why Windows will take longer to support.

This is the same as Windows and Linux having thousands of games to play and Apple having to wait for them to be ported; not supporting open standards and using proprietary ones are the reason for a platform to be behind.

You aren't going to run the server from your developer machine, you will deploy it.

Collapse
 
awongcm profile image
Andy Wong • Edited

You can find their open issue ticket here.
github.com/oven-sh/bun/issues/43
They're definitely working hard towards it in making a reality in a not-so-distant future. :)

Collapse
 
kalashin1 profile image
Kinanee Samson

Yes, that's totally weird, considering that most developers use windows. Let's hope that they make a windows compactible executable soon, rather than later.

Collapse
 
ulitroyo profile image
Uli Troyo

If you're disappointed, from my experience, Bun doesn't keep one waiting very long for new features. The first beta release was only last year, and the speed at which Bun has added node features has been astounding. One time I was sad that I couldn't implement a little game server in Bun because it lacked websockets, and a few weeks later it got it. Another time I was sad because I needed web workers, checked again next month, again got it.

That's been my experience trying to replace Node with Bun: I'd be sad that a certain feature was missing, and it would be implemented the next time I checked. Read streams, Svelte support, Vite support, node:tty... and whenever something would get implemented, it would come with tons of other features and optimizations.

Anyway, hang in there! Jarred and the Oven team are extremely capable and dedicated; I'm sure you won't be waiting long :)

Collapse
 
abunaoufal profile image
AbuNawfal

Windows should move to Unix but keep the UI the same. These c:, d:, e: and so on have been proven to be a bad design. Nowadays kids don’t even know what HDD or SSD are. They only know cloud stuff like OneDrive or Outlook. Developers shouldn’t use Windows, unless you build windows apps using costly commercial Visual Studio. It’s a shame you still use Window$, you should use Linux and enjoy coding.

Collapse
 
shnew profile image
Sh

Yeah it's quite careless

Collapse
 
bernardbaker profile image
Bernard Baker

It would be great if you could cite some references and resources where you claim these numbers come from.

Collapse
 
kalashin1 profile image
Kinanee Samson

You can definitely check up their home page for reference on the numbers

Collapse
 
raulbattistini profile image
raulbattistini

It is just very, very, very slow on WSL. I don't think it's worthy worrying about Bun just yet since it is really new. But its performance does shine bright, with some sequential requests comparing Node (v20) x Bun (v1.0) on Linux (Ubuntu 22.04) and allocating the JSON in memory (common array), the GC-ed time for Bun is amazing.
The benchmarks for 1000 were in contrast with 2min32s for cold run on Node, 1min18s for the second run on Node.

Collapse
 
kalashin1 profile image
Kinanee Samson

This is great to know, I'm glad I didn't really bother trying to set it up on WSL. Although I didn't expect it to be slow on WSL, could this be a platform specific problem or it's just your device.

Collapse
 
raulbattistini profile image
raulbattistini

I'd go on so far to say that it's not a device issue, since the WSL environment was a i7 11th gen, 16GB ram, Nvidia integrated GPU and the Ubuntu environment was a random VPS with a somewhat of a average latency. But things are improving quick, hopefully Bun will be ready for Windows platforms without some workarounds like these

Collapse
 
floverdevel profile image
Ellis

Why does it matter if it's not available for Windows?
I suppose we can run it in Docker anyway, right?

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
floverdevel profile image
Ellis

There is a Docker image available.
It's mentioned here in the official documentation :
bun.sh/docs/installation

docker pull oven/bun
docker run --rm --init --ulimit memlock=-1:-1 oven/bun
Enter fullscreen mode Exit fullscreen mode
Collapse
 
floverdevel profile image
Info Comment hidden by post author - thread only accessible via permalink
Ellis

For me, Docker is not an obstacle.
On the contrary, it actually helps to be cross-platform.
This is not necessarily a good or bad argument, it depends on the reality of each developer :)

Collapse
 
floverdevel profile image
Ellis

Why some of my comments are now hidden?
Image description

Collapse
 
akashkava profile image
Akash Kava

YantraJS is built on .net core and it can run also on mobile devices…

Collapse
 
abunaoufal profile image
AbuNawfal

But who’s behind Bun, what’s the motivation for building Bun besides speed? Is there a company behind Bun who fund the project for own interest? And what about Deno, why not cooperate with Deno?

Collapse
 
kalashin1 profile image
Kinanee Samson

Interesting point, but maybe you could check up the home page to get more information on that

Collapse
 
volodyslav profile image
Volodyslav

Great article 😁 I think Bun might replace Node.js, but it may take around three - five years

Collapse
 
kalashin1 profile image
Kinanee Samson

Thanks Vlad, I have the same opinion too... I see a future where Bun becomes the standard but that's going to take some time though.

Collapse
 
hasanelsherbiny profile image
Hasan Elsherbiny

sounds promising , hope this is not another repeated js framework

Collapse
 
kalashin1 profile image
Kinanee Samson

This one is really different. Bun has a lot of potential.

Some comments have been hidden by the post's author - find out more