Bun: The New JavaScript Runtime

Álvaro José Agámez Licha

Senior Software Developer

https://github.com/aagamezl

https://twitter.com/aagamezl

Overview

What is Bun?

Bun is an all-in-one toolkit (runtime, package manager, bundler, test runner) for JavaScript and TypeScript apps. It ships as a single executable called bun.

Bun is stable and production-ready.

Features

Key Features of Bun

  • Great performance
  • Runtime
  • Package manager
  • Test runner
  • Bundler
  • Package runner
  • TypeScript is a first-class citizen

BUN

It's not a Fight, but...

Node.js, Deno
esbuild, rspack, Parcel, Rollup, Webpack

TSC, Babel, ts-node, ts-node-esm
pnpm, npm, Yarn
Vitest, Jest, Mocha, AVA, SinonJS

Performance

Bun's Impact on JavaScript Performance

  • It natively implements hundreds of Node.js and Web APIs.
  • Obsession with Performance.
  • JavaScriptCore.
  • Zig Language.

Compatibility

Bun's Compatibility with Existing JavaScript Code

Most npm packages intended for Node.js environments will work with Bun out of the box.

Built-in module Total
Fully implemented 30
Partially implemented 15
Not implemented 5
Compatibility List

Adoption

How to Start Using Bun in Your Projects

# For macOS, Linux, and WSL
$ curl -fsSL https://bun.sh/install | bash

# To install a specific version
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.0.0"

Benchmark Time

Introducing Static Hermes

  • Optional ahead-of-time compilation to native code.
  • C performance with JavaScript usability.
  • Mix and match bytecode and native code based on your needs.
  • Requires sound types for performance.
  • Not ready for general usage yet, a work in progress.

Bun: The New Javascript Runtime

By Alvaro Agamez

Bun: The New Javascript Runtime

Bun is a new JavaScript runtime that is generating a lot of excitement in the developer community. It is designed to be fast, lightweight, and efficient, and it offers a number of features that are not available in other JavaScript runtimes.

  • 290