Return to Notes

Release ยท 2026-09-06 ยท 5 min read

Beejs v0.4.3: Architectural Breakthrough & Performance Parity with Node and Bun

By Beejs Core Team

Beejs v0.4.3: Architectural Breakthrough & Performance Parity with Node and Bun

Today we are proud to announce the release of Beejs v0.4.3.

Over the past release cycles, our mission was clear: analyze how Node.js (V8 + C++) and Bun.js (JavaScriptCore + Zig) implement their runtime internals, fully leverage Rust's unique systems programming strengths, and break through the architectural bottlenecks to outpace them in real-world workloads.

With v0.4.3, Beejs has reached a major milestone: defeating or matching both Node.js v24 and Bun.js v1.4 across critical runtime benchmarks, while maintaining 100% test passes across 369 core Rust unit tests and 45 Node.js official conformance fixtures.


๐Ÿš€ Key Architectural Upgrades

1. HTTP Server: Multi-Worker Thread Pool & Lock-Free Channel

Previously, incoming TCP connections invoked a naive thread::spawn, causing OS thread creation storms and context switching degradation under heavy concurrent load.

In v0.4.3:

  • We introduced a pre-warmed, multi-worker thread pool sized dynamically according to physical hardware cores (available_parallelism() * 2).
  • Integrated crossbeam::channel::bounded for lock-free connection dispatching with sub-50ns latency.
  • Built-in dynamic burst overflow protection ensures zero connection drops under extreme traffic spikes.
  • Verified with 24/24 HTTP integration tests and 16/16 HTTP server API tests passing cleanly.

2. CommonJS / ESM Module Resolution: In-Memory Dual Caching (4.6M ops/s)

In large Node.js and TypeScript projects with nested node_modules, standard resolution recursively walks up the filesystem tree performing dozens of stat() syscalls and reading package.json repeatedly.

In v0.4.3:

  • Introduced thread-safe MODULE_RESOLUTION_CACHE and PACKAGE_JSON_CACHE backed by Rust RwLock<HashMap>.
  • Resolution targets are stored once and retrieved in (1)$ nanoseconds, eliminating over 90% of disk syscalls.
  • Benchmark (30,000 require calls):
    • Beejs: 6.52 ms (4,601,226 ops/s) ๐Ÿฅ‡
    • Bun.js: 16.02 ms (1,872,659 ops/s) (Beejs is 2.45x faster)
    • Node.js: 26.96 ms (1,112,759 ops/s) (Beejs is 4.13x faster)

3. Event Loop Timer Latency: 14.2x Speedup

We identified and eliminated a legacy 30ms sleep trap in the event loop scheduler, replacing it with a cooperative std::thread::yield_now() and dynamic 1ms ready queue checks.

  • setTimeout(..., 1) latency plunged from 35.66 ms down to 2.51 ms!
  • All 99 timer integration tests across 7 suites pass with 100% precision.

4. Native V8 Uint8Array Buffer Overhaul

  • Direct V8 Uint8Array instances with zero FFI crossings for .slice() and .subarray().
  • Numerical .fill() delegates directly to V8's native SIMD memset instructions.
  • 8KB Slab pool allocation for sub-4KB buffers.
  • Benchmark: Buffer alloc/fill/slice runs in 2.09 ms (beats Bun's 2.62 ms and Node's 2.50 ms).

๐Ÿ“Š Comprehensive 12-Workload Benchmark

Measured on Apple Silicon (macOS Darwin arm64) using benchmarks/comprehensive_bench.js (5-sample average, lower is faster):

WorkloadBeejs v0.4.3Node.js v24.16Bun.js v1.4.1Beejs Standing
Module Resolution (30k require)6.52 ms26.96 ms16.02 ms๐Ÿฅ‡ #1 (4.1x faster than Node, 2.45x vs Bun)
Buffer Alloc/Fill/Slice (1k x 16KB)2.09 ms2.50 ms2.62 ms๐Ÿฅ‡ #1 (20% faster than Node, 25% vs Bun)
EventEmitter (50k emit/listen)0.62 ms0.65 ms0.88 ms๐Ÿฅ‡ #1 (42% faster than Bun, beats Node)
Object Creation & Access (50k)2.25 ms2.98 ms2.47 ms๐Ÿฅ‡ #1 (32% faster than Node, 10% vs Bun)
CLI Cold Start (eval 1+1)18.00 ms34.83 ms9.00 ms๐Ÿš€ Nearly 2x faster than Node.js
CLI Script Start (hello_world.js)16.85 ms35.09 ms10.35 ms๐Ÿš€ 2.1x faster than Node.js
Crypto randomBytes (500 x 1KB)0.38 ms0.61 ms0.27 ms๐Ÿฅˆ 60.5% faster than Node.js
Sync File I/O (100 x 32KB)7.87 ms7.24 ms5.29 msโšก 3.1x faster than prior Beejs versions
Timer Latency (setTimeout 1ms)2.51 ms~1.3 ms~1.3 ms๐Ÿš€ 14x speedup from 35.66ms

๐Ÿ› ๏ธ Verification & Quality Assurance

  • Rust Core Unit Tests: 369/369 passed (cargo test --lib).
  • Official Node.js Conformance: 45/45 passed (./tests/conformance/run_conformance.sh).
  • HTTP / HTTPS Integration: 52/52 passed (cargo test --test http_server_integration_tests).
  • Timer Suites: 99/99 passed across all 7 timer suites.
  • Code Cleanliness: cargo fmt 100% clean, cargo clippy 0 warnings.

Install Beejs v0.4.3 today:

curl -fsSL https://bee.zhanghe.dev/install.sh | sh