Jarred Sumner, the creator and lead developer of the server-side JavaScript platform Bun, has created a Git branch to rewrite Bun from Zig to Rust. The rewriting is being conducted with the help of the AI assistant Claude, for which a separate porting guide has been created. According to Jarred, this is still just an experiment and not an official port, and there is a high chance that it will not progress beyond the experimental stage and the rewritten code will not be used.
The porting is not yet complete, and at this stage, all interest in the project is focused on assessing how functional the port will be, whether it will pass the main project's test suite, and how difficult it will be to maintain the new code. Ultimately, comparative testing of the Bun versions in Zig and Rust is planned.
Last December, the Bun project was acquired by Anthropic, providing Jarred with the resources to involve advanced AI models like Claude in the porting process. The Bun platform is used in the Claude Code and Claude Agent SDK products, and Anthropic is interested in improving its quality and development. Bun is one of the most successful projects in the Zig language, yet opinions among Zig and Bun developers diverge regarding the use of AI in the development process. A strict ban has been instituted on the use of large language models when preparing pull requests, issues, and comments in the Zig project (even AI translation of non-English comments is prohibited).
The introduction of such restrictions is explained by the Zig developers due to negative experiences with the review of AI-generated pull requests, which consume resources and time (for example, meaningless changes, AI hallucinations, and bloated commits of 10,000 lines are noted). Moreover, the Zig project positions itself as participant-oriented, rather than focusing on the contributions made by them to the development — the main goal of accepting pull requests is said to be helping new participants grow rather than simply adding new code.
Author Bun disagrees with the ban on AI in Zig and believes that AI usage will remain a nostalgic relic of 2025 and 2026, while the development of open-source software will evolve to prohibit the acceptance of code from humans. People will discuss issues, set tasks, and prioritize, while coding and submitting changes to repositories will become the domain of AI. The reason for experimenting with rewriting in Rust is also attributed to the desire to resolve issues in Bun caused by memory leaks and Zig's unacceptable policy regarding changes that compromise compatibility.
Due to the AI application ban, Bun developers are forced to maintain their own fork of the Zig toolchain, which, thanks to AI implementation, has accelerated compilation by 4 times through parallelizing semantic analysis and code generation. According to one Zig developer's comment, the reason for patch rejection is not AI but the fact that parallelizing semantic analysis affects not just the compiler, but the language itself — to implement the proposed functionality without errors and incompatibilities, changes to the Zig language are required. Instead of parallelization, Zig developers are advancing incremental compilation, which they believe will significantly improve compilation speed.
The JavaScript platform Bun is evolving as a high-performance alternative to Node.js and Deno platforms. The project is developed with an eye towards ensuring compatibility with server applications for Node.js and supports most of the Node.js API. The platform includes a set of tools for creating and running applications in JavaScript and TypeScript, as well as a runtime for executing JavaScript applications without a browser, a package manager (compatible with NPM), testing toolkit, a system for building self-contained packages, 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 platform is twice as fast as Deno and almost 5 times faster than Node.js). The JavaScript engine JavaScriptCore and components from the WebKit project with additional patches are used for executing JavaScript.
Source: opennet.ru
