A fost aprobată traducerea platformei JavaScript Bun în limbajul Rust.

Jarred Sumner, creator and lead developer of the server-side JavaScript platform Bun, acknowledged the successful experiment of rewriting the project from Zig and Rust using the AI assistant Claude Code, and made the decision to transition Bun to Rust. The rewritten version in Rust has already been accepted into the project's main repository, and the code in Zig is scheduled for removal. Jarred also announced the hiring of employees to support Bun, who have over 5 years of experience in C/C++ and Rust development.

Currently, a direct port from Zig to Rust has been implemented, which includes many blocks of unsafe code, utilizes the same architecture, the same data structures, and previous external libraries. It is noted that the Rust port has successfully passed the existing test suite on all platforms. In the process, several memory leaks and test failures have been resolved.

After building the version in Rust, the resulting executable file is 3-8 MB smaller compared to the version built in Zig. In performance tests, the Rust version was either faster or on par with the previous one. According to Jarred, the most important advantage of the Rust version is the ability to catch and prevent memory-related errors, the diagnosis of which has taken a significant amount of time from Bun developers in recent years.

The reason for rewriting in Rust was previously cited as the desire to address issues in Bun caused by memory leaks, disagreements with Zig authors regarding the use of AI for code writing, and the unacceptable policy of Zig regarding changes that break compatibility for large projects.

Platforma JavaScript Bun se dezvoltă ca un echivalent de înaltă performanță al platformelor Node.js și Deno. Proiectul este dezvoltat având în vedere asigurarea compatibilității cu aplicațiile server pentru Node.js și susține cea mai mare parte a API-ului Node.js. Platforma include un set de instrumente pentru crearea și rularea aplicațiilor în limbajele JavaScript și TypeScript, precum și un runtime pentru executarea aplicațiilor JavaScript fără browser, un manager de pachete (compatibil cu NPM), un instrumentar pentru executarea testelor, un sistem de construire a pachetelor autonome și un strat pentru integrarea handler-elor scrise în limbajul C. În ceea ce privește performanța, Bun depășește semnificativ Deno și Node.js (în testele bazate pe framework-ul React, platforma Bun depășește Deno de 2 ori și aproape de 5 ori Node.js). Pentru a executa JavaScript, este utilizat motorul JavaScript JavaScriptCore și componentele proiectului WebKit cu patch-uri suplimentare.

Sursa: opennet.ro

Cumpără un hosting fiabil pentru site-uri cu protecție DDoS, servere VPS VDS 🔥 Cumpără un hosting fiabil pentru site-uri cu protecție DDoS, servere VPS VDS | ProHoster