Cruller:Bun 的 Zig 运行时,基于 Zig 0.16 续写
Cruller: Bun's Zig Runtime, Continued on Zig 0.16

原始链接: https://ziggit.dev/t/cruller-buns-zig-runtime-continued-on-zig-0-16/16734

**Cruller** 是 Bun 运行时的一个轻量级分支,专为执行预构建的生产级 JavaScript 服务器而优化。通过剔除包管理器、打包器、转译器和测试运行器等侧重于开发的特性,Cruller 仅专注于核心运行时功能,包括 `Bun.serve`、HTTP/1-3、WebSockets 和 `fetch`。 该项目移植到了原生 Zig 0.16,通过自定义的生成代码嵌入模块,简化了构建图并提高了可移植性。与官方 Bun 发行版相比,此重新设计使二进制文件体积缩小了约 18%,同时保持了 JavaScript 执行的性能水平。 作为一款专用运行时而非通用的 Bun 替代品,Cruller 专为那些在其他环节处理打包或转译基础设施的环境而设计。尽管目前尚处于开发阶段且主要支持 Linux x64,但该运行时已成功通过了核心冒烟测试,包括 CJS/ESM 入口点和 HTTP 服务器功能。通过将运行时与 Bun 原本复杂的构建集成剥离,Cruller 为托管静态和服务器端 JavaScript 应用程序提供了一种专注且高效的解决方案。

对不起。
相关文章

原文

Cruller is a fork of the last Zig-based Bun release, reduced to the parts needed to run already-built production JavaScript servers and ported to vanilla Zig 0.16.

Repository: GitHub - solenopsys/cruller: fork of Bun · GitHub

The project keeps JavaScriptCore, Bun.serve, HTTP/1-3, WebSockets, fetch, streams, Blob, Request/Response, static serving, and the module resolver for pre-built JavaScript. It removes the package manager, bundler/transpiler, shell, test runner, most CLI dispatch, N-API, SQL clients, archive support, and other development-oriented subsystems.

The interesting part of the port was separating the runtime from Bun’s old patched Zig build integration. Cruller now has a vanilla Zig 0.16 build graph, compatibility shims for APIs changed since Zig 0.15, and a generated-code embedding module so release builds remain portable instead of loading generated JS from the build directory at runtime.

The main design decision is to treat this as a runtime, not a general-purpose Bun replacement. A minimal launcher loads a pre-built entrypoint; features that require package installation, bundling, TypeScript transformation, or bun test are intentionally outside the scope.

Current measurements on Linux x64, compared with the official Bun 1.3.14 binary:

  • Cruller ReleaseFast stripped runtime: 73.0 MiB
  • Official Bun runtime: 88.5 MiB
  • Size reduction: about 18%
  • V8 Crypto pure-JS benchmark: performance parity; Cruller’s median was about 2% higher, within normal run-to-run variance

The runtime is still work in progress, but Zig semantic checks, release builds, CJS/ESM entrypoints, Node path tests, and an HTTP Bun.serve plus built-in fetch() smoke test currently pass.

Supported Zig versions

  • Zig 0.16.0
  • Linux x64 is the currently supported build target

Suggested topic tags: showcase, zig-0-16, llm

AI / LLM usage disclosure

AI was used as an engineering assistant for parts of the Zig 0.16 migration, build/debug investigation, and focused test work. The project scope, architecture decisions, review of changes, and build/test verification remain maintainer-directed. This is not a purely AI-generated project.

联系我们 contact @ memedata.com