WhoBuilt

Jarred Sumner on Bun: hyperfast JavaScript toolkit

Sep 19, 2023· 1 h 5 min· 1.7K views·Watch on YouTube

Speaker

Jarred Sumner, creator of Bun at Oven, explains Bun’s design, performance, and possible uses in React Native with Callstack on React Universe On Air: Coffee Talk #14.

Why Bun combines JavaScript tools

Sumner describes Bun as a JavaScript runtime, package manager, task runner, and test runner built to simplify common workflows. He says the ecosystem has become complicated and pieced together, and argues that faster tools help developers spend less time waiting and switching contexts. Bun aims to work with existing tools: developers can keep using Yarn, npm, and familiar build tools.

Performance from system calls to SIMD

Sumner credits Bun’s speed to many small optimizations informed by profiling. On macOS, `bun install` uses `clonefile` for copy-on-write directory cloning; Bun also reduces path copying, optimizes lockfile serialization, and uses SIMD to process text in larger chunks. He says the transpiler uses SIMD when parsing large inputs such as source maps.

From a slow game refresh to a runtime

Bun began after Sumner found that refreshing his browser voxel game took 30 seconds to a minute. He built a transpiler, then added a runtime after aiming to support Next.js, embedding JavaScriptCore after studying its code. He chose Zig because he found it productive and predictable, with explicit memory management and development checks.

Compatibility, installs, and React Native ideas

Sumner says `bun install` is likely Bun’s easiest feature to adopt, while Bun test still lacked `extends`, inline snapshots, and mock modules at the time. Bun’s binary lockfile and file operations contribute to install speed; dependency postinstall scripts were disabled by default, with an allowlist planned for packages that need them. For React Native, he discusses possible future bundler or on-device runtime uses, but stresses these ideas were speculative and unimplemented.

Team priorities and future plans

Sumner says Bun aims to replace Node.js while implementing most of its core modules, though some were still missing. Windows support was limited, and he cited the small team and hiring needs as factors. He also described plans for hosting through the Bun CLI, but gave no release date and said bug fixing remained the priority.

Takeaways

  • Reduce workflow friction by improving the tools developers use repeatedly, not only runtime execution.
  • Profile before optimizing, then target concrete costs such as system calls, allocations, and serialization.
  • Design compatibility so teams can adopt useful pieces without replacing their whole toolchain.
  • Treat disabled install scripts as both a speed choice and a security decision, and make exceptions explicit.
  • Keep speculative integrations distinct from shipped features when communicating a roadmap.

Mentioned in this talk

Search inside this talk

What was claimed 16

  • launched
    Bun: Version 1.0
    “released not so long ago with version 1.0”
    YouTube
    Unverified1 source· Talk
  • feature
    Bun: JavaScript runtime, package manager, task runner, and test runner
    “Bun is an incredibly fast JavaScript runtime, package manager, task runner, and test runner.”
    YouTube
    Unverified1 source· Talk
  • metric
    Bun: 60,000 GitHub stars
    “We passed 60,000 stars on GitHub.”
    YouTube
    Unverified1 source· Talk
  • feature
    Bun: MacOS package installation uses the clonefile system call for copy-on-write directory trees
    “on macOS we use the clonefile system call”
    YouTube
    Unverified1 source· Talk
  • uses
    “Then I tried JavaScriptCore, and it seemed like a good balance”
    YouTube
    Unverified1 source· Talk
  • previously at
    Jarred Sumner previously at Stripe
    “when I was at Stripe”
    YouTube
    Unverified1 source· Talk
  • uses
    Bun uses Zig
    “I just quickly found myself being super productive in it.”
    YouTube
    Unverified1 source· Talk
  • feature
    Bun: Binary lockfile designed for fast serialization and deserialization
    “our lockfile is binary, and we put a lot of effort into making it fast to serialize and deserialize”
    YouTube
    Unverified1 source· Talk
  • feature
    Bun: Does not run dependency postinstall scripts by default
    “we don't run postinstall scripts for dependencies”
    YouTube
    Unverified1 source· Talk
  • feature
    Bun: Plans to let users allow selected packages to run postinstall scripts
    “we're going to have a way to allow them”
    YouTube
    Unverified1 source· Talk
  • integrates with
    Bun integrates with Node.js
    “Bun aims to be a drop-in replacement for Node.js”
    YouTube
    Unverified1 source· Talk
  • metric
    Bun: Team of seven full-time people
    “Our team is seven people full time”
    YouTube
    Unverified1 source· Talk
  • metric
    Bun: More than 600 open issues
    “We have more than 600 issues, or something like that, in our repo”
    YouTube
    Unverified1 source· Talk
  • feature
    Bun: Bundler macros can evaluate code at compile time and inline the result
    “lets you evaluate code at compile time”
    YouTube
    Unverified1 source· Talk
  • integrates with
    Bun integrates with React Native
    “Bun and its tools—bun install and bun run—would make it faster to install packages and run scripts.”
    YouTube
    Unverified1 source· Talk
  • feature
    Bun: Plans to offer hosting with deployment from the Bun CLI
    “From the Bun CLI, there will be a subcommand for deploying directly to production.”
    YouTube
    Unverified1 source· Talk

Related talks