Bun 1.4, a platform designed for standalone execution of JavaScript and TypeScript applications and intended to serve as a seamless replacement for Node.js, has been released. The 1.4 branch is notable for its codebase migration from Zig to Rust, accomplished using Claude AI tools. The code remains licensed under the MIT license.
The reasons cited for rewriting to Rust include a desire to address issues in Bun caused by memory leaks, as well as disagreements with the Zig authors regarding the use of AI for coding, and Zig's policy regarding accepting language changes that break compatibility, which is unacceptable for large projects. The main advantage of switching to Rust is the ability to catch and prevent memory errors, which had been consuming Bun developers' time in recent years.
Based on benchmarks, the Rust version consumes 13-48% less memory, launches twice as fast, and uses up to 5 times less CPU when idle. The Rust version's executable file size has been reduced by 17%. When running Claude Code with Bun 1.4, CPU load was halved.
The release includes 1517 additional compatibility tests and fixes over 2900 issues. New libraries, Bun.Image, Bun.WebView, Bun.markdown, Bun.cron(), and Bun.Terminal, have been added to the base distribution. Parallel execution mode (--parallel) is now implemented in the "bun run" and "bun test" commands. Compatibility with the Next.js 16 and vitest frameworks is now ensured.
The Bun project supports most of the Node.js API. The platform includes a set of tools for creating and running JavaScript and TypeScript applications, as well as a runtime for executing JavaScript applications without a browser, a package manager (compatible with NPM), test tools, a self-contained package builder, and a layer for embedding handlers written in C. In terms of performance, Bun significantly outperforms Deno and Node.js (in tests based on the React framework, Bun outperforms Deno by a factor of 2 and Node.js by a factor of almost 5). JavaScript execution utilizes the JavaScriptCore JavaScript engine and WebKit components with additional patches.
Source: opennet.ru
