the new kid on the block, Bun!

July 11, 2022

There’s a new kid on the block and he’s really dope.

bun logo

Bun is a modern JavaScript runtime

Why is it so hyped up?

  • Bun is fast. Really fast.
  • Bun also has a built-in bundler and transpiler.
  • Bun is and aims to be more and more compatible with NodeJS.
  • Bun supports Typescript and JSX out of the box.

and much more (unit tests, env variables…)…

Check the full Bun Roadmap to see where its headed

As of today, citing the docs

Bun natively implements hundreds of Node.js and Web APIs, including ~90% of Node-API functions (native modules), fs, path, Buffer and more.

Why is Bun so fast?
While Node and Deno embed the most famous and "more traditional" engine Google's V8, Bun embeds the Webkit based browsers' engine: JavascriptCore.

Generally JavascriptCore tends to start faster than V8, but it is considered harder to work with.

I’m writing a series about the Google’s V8

Bun is also mainly written in Zig, a low level programming language with manual memory management.

All these factors and a really thoughtful and extensive code optimization make Bun blazingly fast.



Transpiler Transpiling is the act of converting a source code file into another source code file. This conversion, or also called source to source compilation, can happen from a programming language to another programming language (i.e. Emscripten transpiles C/C++ to Javascript) or from one version of a programming language to another version (i.e. Babel can be used to transpile ES6 Javascript to ES5 Javascript).

Bundler Bundling (in Javascript context) is the act of combining together multiple Javascript files and their dependencies into a single file, usually for the usage in the browser. How bundlers work.

References

Bun Website
Contribute to Bun
Bun docs

Want to read more?

Subscribe to the newsletter, opt-out anytime.

© 2022, Thomas Albertini