Home  >  Article  >  Web Front-end  >  Fire! New JavaScript runtime: Bun, performance surpasses Node

Fire! New JavaScript runtime: Bun, performance surpasses Node

青灯夜游
青灯夜游forward
2022-07-15 14:03:404442browse

Today I would like to introduce to you the latest open source javaScript runtime: Bun.js. Three times faster than Node.js, the new JavaScript runtime Bun is hot!

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 was "built from the ground up to focus on three areas":

  • Get started quickly (with the advantages in mind).

  • New performance levels (extended JavaScriptCore, engine).

  • As a great and complete tool (bundler, translator, 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 with better , simpler tools improve developer productivity.

Better performance

It has the same performance as Node.js and Deno in terms of serve, sqlite and ffi The comparison is as follows:

Fire! New JavaScript runtime: Bun, performance surpasses Node

Fire! New JavaScript runtime: Bun, performance surpasses Node

Fire! New JavaScript runtime: Bun, performance surpasses Node

According to the official website test screenshot, the server-side rendering speed of React is Node Or more than three times that of 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 uses JavaScriptCore engine, different engines will produce different performance;

  • uses the emerging system programming language Zig. The creator of Bun said that Zig's lack of hidden control flow makes it easier to write fast software Simple.

So far, most observers agree that Bun deserves attention in terms of performance, and that npm module compatibility is a huge plus. But it’s worth noting that Bun is still in its early stages, with a beta version only recently released.

Reference link:

  • 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

For more programming-related knowledge, please visit: Programming Video! !

The above is the detailed content of Fire! New JavaScript runtime: Bun, performance surpasses Node. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:toutiao.com. If there is any infringement, please contact admin@php.cn delete