Hacker News new | past | comments | ask | show | jobs | submit login

This is a fantastic talk on some of the optimizations that Zig makes easy to implement: https://vimeo.com/649009599

Bun is written in Zig, but it takes the same approach that esbuild took to make things fast: a linear, synchronous pipeline fitting as much as possible in the CPU cache with as little allocation and other overhead as possible. Zig has more knobs to turn than Go.

Bun goes one step further and does a great job of offloading work to the kernel when possible, too (i.e. the large file I/O improvement with the Linux kernel)




Zig is cool, but Bun heavily relies on JSC which is written in C++


JSC is a multi-tier JIT with the last stage ultimately being LLVM, so if you want to be pedantic, Bun relies on LLVM’s optimizer which is written in C++.

The transpiling itself is written in Zig, which is the part that has the performance improvement. If Bun relied on JavaScript and JSC for the heavy lifting, it would be no faster than the other JS bundlers.

edit: no longer LLVM: https://webkit.org/blog/5852/introducing-the-b3-jit-compiler...


But bundling doesn't




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: