Sunday, January 08, 2023

Bun: fast all-in-one JavaScript runtime

Bun is written in Zig and uses JavaScriptCore. These choices are interesting because most other server side JavaScript runtimes use V8, Google Chrome’s JavaScript runtime. On the other hand, JavaScriptCore is by Apple for Safari. Bun claims that JavaScriptCore offers better performance and is more lightweight, which is part of how it achieves its performance.

What is Bun, and does it live up to the hype?

oven-sh/bun: Incredibly fast JavaScript runtime, bundler, transpiler and package manager – all in one.

"zig" source code example

Is JavaScriptCore (JSC) really the reason bun.js is so fast? Is V8 that slow? Is JSC the fastest? - YouTube

Bun — fast all-in-one JavaScript runtime

Bun is a modern JavaScript runtime like Node or Deno. It was built from scratch to focus on three main things:Start fast (it has the edge in mind).
New levels of performance (extending JavaScriptCore, the engine).
Being a great and complete tool (bundler, transpiler, package manager).

Bun is designed as a drop-in replacement for your current JavaScript & TypeScript apps or scripts — on your local computer, server or on the edge. Bun natively implements hundreds of Node.js and Web APIs, including ~90% of Node-API functions (native modules), fs, path, Buffer and more.

No comments: