A new JavaScript runtime fresh out of the oven

A significant portion of Hackaday's audience groans and widens their eyes when a new JavaScript gimmick comes out. So what makes Bun different? Bun is a runtime (like Node or Deno)t that offers a powerful all-in-one approach. Much to the Spice Girl's delight, it's written in Zig. It offers grouping, transpiling, module resolution and a fantastic foreign function interface.

Node.js and Deno run on the V8 JavaScript engine and provide the Node API to access different features, such as file systems, that are not applicable to web browsers. However, vast amounts of tools have accumulated around Node.js and NPM (node ​​package manager). Many JavaScript projects have a bundling and transpiling step that takes the source and bundles it into a more standard format. Typescript must be packaged in javascript and modules must be resolved.

Bun incorporates all of this. Typescript and JSX "just work". This greatly simplifies many projects because much of the building infrastructure is part of Bun itself, reducing the cognitive load when trying to figure out a project. A SQL client and a Jest-like unit test runner are both integrated. Rather than V8, it uses JavaScriptCore, which boots up a bit faster. But the incredible speedups offered by Bun mainly come from its Zig writing and the amount of effort put into benchmarking, profiling, and optimization. What's even crazier is that Bun is written by one person, [Jared Sumner].

Since Bun has implemented most of the Node APIs (and more to come), many modules are compatible. Some web-specific APIs, such as fetch and Websockets, are also integrated. This is an early project, and we are wary of any claims made by the developers of the project, but we are cautiously optimistic. Even if you're not into JavaScript, you'll probably end up learning WebAssembly. A short video from [Fireship] gives a good overview. All of Bun's code is on Github under an MIT license if you want to check it out yourself.

Thanks to [Michael Carlson] for the terrible Spice Girl joke.

A new JavaScript runtime fresh out of the oven

A significant portion of Hackaday's audience groans and widens their eyes when a new JavaScript gimmick comes out. So what makes Bun different? Bun is a runtime (like Node or Deno)t that offers a powerful all-in-one approach. Much to the Spice Girl's delight, it's written in Zig. It offers grouping, transpiling, module resolution and a fantastic foreign function interface.

Node.js and Deno run on the V8 JavaScript engine and provide the Node API to access different features, such as file systems, that are not applicable to web browsers. However, vast amounts of tools have accumulated around Node.js and NPM (node ​​package manager). Many JavaScript projects have a bundling and transpiling step that takes the source and bundles it into a more standard format. Typescript must be packaged in javascript and modules must be resolved.

Bun incorporates all of this. Typescript and JSX "just work". This greatly simplifies many projects because much of the building infrastructure is part of Bun itself, reducing the cognitive load when trying to figure out a project. A SQL client and a Jest-like unit test runner are both integrated. Rather than V8, it uses JavaScriptCore, which boots up a bit faster. But the incredible speedups offered by Bun mainly come from its Zig writing and the amount of effort put into benchmarking, profiling, and optimization. What's even crazier is that Bun is written by one person, [Jared Sumner].

Since Bun has implemented most of the Node APIs (and more to come), many modules are compatible. Some web-specific APIs, such as fetch and Websockets, are also integrated. This is an early project, and we are wary of any claims made by the developers of the project, but we are cautiously optimistic. Even if you're not into JavaScript, you'll probably end up learning WebAssembly. A short video from [Fireship] gives a good overview. All of Bun's code is on Github under an MIT license if you want to check it out yourself.

Thanks to [Michael Carlson] for the terrible Spice Girl joke.

What's Your Reaction?

like

dislike

love

funny

angry

sad

wow