Bun, the new Javascript runtime competing with Deno and Node

Incredible amounts of discussion have taken place over the past couple years over Deno, Ryan Dahl’s successor to the NodeJS runtime meant to solve all the problems of his original creation.

In reality, despite Deno being largely stable and solving a l…


This content originally appeared on DEV Community and was authored by Saji Wang

Incredible amounts of discussion have taken place over the past couple years over Deno, Ryan Dahl’s successor to the NodeJS runtime meant to solve all the problems of his original creation.

In reality, despite Deno being largely stable and solving a lot of the issues with Node, it hasn’t received significant adoption because it isn’t compatible with existing node modules.

The development world was caught by surprise when Bun, a new Javascript runtime, launched its public beta about a week ago.

Bun’s pitch is that it is solving the problems that Deno does and is compatible with the existing Node ecospace, all while being significantly faster than both Deno and Node.

Let’s dive in

The Issues with Node

Despite its widespread usage for the past decade, NodeJS has its fair share of problems.

The most egregious issue with Node is the incredibly convoluted nature of NPM and the entire module system. Not only can it be incredibly slow and unsecure, but the design of the system is drastically different from what is typical of web technologies.

Additionally, Node has near complete access to the system, which is a major security flaw.

On top of all that, some of the standard capabilities that a developer is going to need, like environment variables, https, or Typescript, aren’t included in Node out of the box.

Most of these issues seem to be solved with Deno, but at the expense of the entirety of the Node ecosystem. For the vast majority of developers, solving these issues simply isn’t worth jumping into a completely new ecosystem, and thus we haven’t seen adoption of Deno.

How Bun solves them

Now while Bun is very much in its infancy, it seems to largely be solving the lack of built-in support and the unfortunate speed issues of Node.

Bun claims to be more than twice efficient on many key tasks than both Node and Deno

Image description

Image description

Image description

Bun achieves this by not running on the V8 engine that Deno and Node use, and instead opting for the incredibly low level language Zig.

Additionally, Bun is a drop-in solution for Node, so it is already compatible with the entirety of the Node ecosystem that’s out there.

Trying out Bun

You can install Bun on Mac and Linux with:
curl https://bun.sh/install | bash

And then you can run a js file with:
bun run index.js

And you can install your NPM packages with:
bun install package-name

As you can see, the CLI is effectively identical to Node’s, which means there’s no learning curve.

What to Keep in Mind

Keep in mind that Bun was launched barely over a week ago. It is still very-much full of bugs. You are likely to run into some issues if you are trying to play around with it.

Additionally, this means we are yet to see what comes of this project. Will it really solve all the issues of Node and finally dethrone it? Maybe. But it might also be the case that Bun simply can never achieve the stability of Node.

We will likely find out the fate of BunJS over the next year…

At Codesphere, we’re also in the business of making web development faster, smoother, and less stressful. We’re building an all-in-one web IDE, DevOps tool, and cloud provider.

Happy Coding!


This content originally appeared on DEV Community and was authored by Saji Wang


Print Share Comment Cite Upload Translate Updates
APA

Saji Wang | Sciencx (2022-07-13T14:51:11+00:00) Bun, the new Javascript runtime competing with Deno and Node. Retrieved from https://www.scien.cx/2022/07/13/bun-the-new-javascript-runtime-competing-with-deno-and-node/

MLA
" » Bun, the new Javascript runtime competing with Deno and Node." Saji Wang | Sciencx - Wednesday July 13, 2022, https://www.scien.cx/2022/07/13/bun-the-new-javascript-runtime-competing-with-deno-and-node/
HARVARD
Saji Wang | Sciencx Wednesday July 13, 2022 » Bun, the new Javascript runtime competing with Deno and Node., viewed ,<https://www.scien.cx/2022/07/13/bun-the-new-javascript-runtime-competing-with-deno-and-node/>
VANCOUVER
Saji Wang | Sciencx - » Bun, the new Javascript runtime competing with Deno and Node. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/07/13/bun-the-new-javascript-runtime-competing-with-deno-and-node/
CHICAGO
" » Bun, the new Javascript runtime competing with Deno and Node." Saji Wang | Sciencx - Accessed . https://www.scien.cx/2022/07/13/bun-the-new-javascript-runtime-competing-with-deno-and-node/
IEEE
" » Bun, the new Javascript runtime competing with Deno and Node." Saji Wang | Sciencx [Online]. Available: https://www.scien.cx/2022/07/13/bun-the-new-javascript-runtime-competing-with-deno-and-node/. [Accessed: ]
rf:citation
» Bun, the new Javascript runtime competing with Deno and Node | Saji Wang | Sciencx | https://www.scien.cx/2022/07/13/bun-the-new-javascript-runtime-competing-with-deno-and-node/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.