Getty Images

New JavaScript runtime Bun challenges Deno, Node.js

Beta release of JavaScript runtime Bun promises to speed up development with an array of out-of-the box features.

Bun, an all-in-one JavaScript runtime with enhanced performance, is now available in beta release.

Designed to compete with Node.js and Deno, Bun features a native bundler for combining multiple JavaScript code files, a task runner for automating repetitive tasks and a transpiler. The transpiler, which transforms one source code into another, can handle JavaScript XML (JSX) files -- syntax extensions to JavaScript -- and allows developers to write TypeScript out of the box. Other notable features include support for a range of Node and web APIs; the ability to use NPM, Node.js' package manager; and increased performance, according to the Bun website.

Bun seems to be focusing on startup speed, which makes it a good choice for edge use cases, said Andrew Cornwall, senior analyst at Forrester Research. But that means it is competing with WebAssembly runtimes that can start even faster, he said.

However, Bun is already showing interesting enough performance to make developers consider it as an alternative to runtimes such as Node.js and Deno, said Holger Mueller, vice president and analyst at Constellation Research.

"Given the popularity of JavaScript on the one hand, and its performance issues and complexities on the other hand, it is no surprise new runtime replacements are popular," Mueller said.

JavaScript runtime Bun ramps up the speed

Bun is about three times faster than Node and Deno when server-rendering React or running database queries. Bun's speed stems from the fact that it is built around Webkit's JavaScriptCore framework, which tends to be faster than the more traditional V8 JavaScript engine used for Chrome, Deno and Node.js, according to Bun.

Another factor leading to increased speed is that the Bun JavaScript runtime is written in Zig, a low-level programming language that can be read by system hardware. This makes it simpler to write faster software due to low-level control over memory and lack of hidden control flow -- such as surprise jumps away to call functions, according to Bun.

But while Zig can compile to Windows and Arm, it is a less-well-known language, which limits Bun's potential developer pool, Cornwall said.

It's not likely that Bun will cause a large-scale flight from Node.js just yet, but it might find a place in the toolbox.
Andrew CornwallSenior analyst, Forrester Research

Bun may have adoptability issues

While Deno and Node.js can run on multiple platforms, Bun is tied to high-performance Unix variants -- macOS (x86 and Arm), Linux or Microsoft Windows Subsystem for Linux (WSL), which limits its use, Cornwall said. Windows developers will have to use WSL -- which is primarily aimed at Linux developers operating in a Windows environment and comes with limitations such as only being available for Windows 10.

Despite these drawbacks, Bun is worth watching -- especially if it picks up sponsorship from a major edge provider who wants to replace V8 for short-running tasks, Cornwall said.

"It's not likely that Bun will cause a large-scale flight from Node.js just yet, but it might find a place in the toolbox," Cornwall said.

Developers can install Bun by running an install script to download Bun from GitHub.

Dig Deeper on Software design and development

Cloud Computing
App Architecture
ITOperations
TheServerSide.com
SearchAWS
Close
  翻译: