Bun, an all-in-one JavaScript runtime with enhanced performance, is now available in beta.
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. A transpiler that converts one source code to another can process JavaScript XML (JSX) files (a syntactical extension of JavaScript) and allows developers to write TypeScript out of the box. Other notable features include support for various Node and Web APIs. Ability to use NPM, a package manager for Node.js. According to Bun’s website, performance has improved.
Forrester Research Senior Analyst Andrew Cornwall said Bun appears to be focused on boot speed, making it well suited for edge use cases. But that means you’re competing with the WebAssembly runtime, which can start faster.
But Bun is already showing interesting performance that developers see as an alternative to runtimes like 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 complexity on the other, it’s no surprise that new runtime alternatives are gaining popularity,” Mueller said.
JavaScript runtime Bun gets faster
Bun is about 3x faster than Node and Deno when server rendering React and executing database queries. Bun’s speed stems from the fact that, according to Bun, it’s built around Webkit’s JavaScriptCore framework. This framework tends to be faster than the traditional V8 JavaScript engine used by Chrome, Deno, and Node.js.
Another factor contributing to the speedup 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 easier to write faster software because of low-level control over memory and no hidden control flow such as surprise jumps to call functions, Bun said.
But while Zig can be compiled to Windows and Arm, it’s a lesser-known language, limiting Bun’s potential developer pool, Cornwall said.
Bun isn’t likely to cause a massive departure from Node.js yet, but it could find a place in the toolbox.
Andrew CornwallForrester Research Senior Analyst
Bun may have adoptability issues
Deno and Node.js can run on multiple platforms, but Bun is associated with high-performance Unix variants: macOS (x86 and Arm), Linux, or Microsoft Windows Subsystem for Linux (WSL), so its Its use is limited, Cornwall said. Windows developer he should use WSL. WSL is primarily intended for Linux developers working in a Windows environment, and has limitations such as being available only on Windows 10.
Despite these shortcomings, Bun is noteworthy. It’s notable, he said, especially when he gets sponsorship from a major edge provider who wants to replace V8 for short-term tasks.
“It’s not likely that Bun will cause a major migration away from Node.js yet, but it could find a place in the toolbox,” Cornwall said.
Developers can install Bun by running the installation script and downloading Bun from GitHub.