Recently, the front-end tool chain Bun project has attracted a lot of attention. Bun is a modern JavaScript runtime like Node or Deno, written by Jarred Sumner, formerly of Stripe and Thiel Fellowship.
Bun natively implements hundreds of Node.js and Web APIs, including about 90% of Node-API functions (native modules), fs, path, Buffer, etc. And according to its newly launched website, it's "built from the ground up to focus on three things":
Get started quickly (with the benefits in mind).
New performance levels (extended JavaScriptCore, engine).
As a great and complete tool (bundler, transpiler, package manager).
Bun's goal is to run most of the world's JavaScript outside of the browser, bringing performance and complexity enhancements to your future infrastructure and increasing developer productivity through better, simpler tools.
Better performance.
Its performance comparison with Node.js and Deno in terms of serve, sqlite, and ffi is as follows:
According to test screenshots from the official website, the server-side rendering speed of React is more than three times that of Node or Deno. At the same time, the official website also gives the reason why Bun’s performance is so good:
Unlike Node.js and Deno, which use the V8 engine, Bun Using the JavaScriptCore engine, different engines will produce different performance;
using the emerging system programming language Zig, Bun's creator said that Zig's lack of hidden control flow makes it easier to write fast software.
So far, most observers agree that Bun deserves attention in terms of performance, and that npm module compatibility is a huge plus. However, it is worth noting that Bun is still in its early stages and the Beta version was only recently released.
Reference links:
https://developers.slashdot.org/story/22/07/10/000246/meet-bun-a-speedy-new-javascript-runtime
https://devclass.com/2022/07/06/ zig-based-bun-appears-in-beta-an-incredibly-fast-all-in-one-javascript-runtime/
Project address:
https://github.com/oven-sh/bun