Skip to content

quickjs-oxide v0.3.1

Choose a tag to compare

@github-actions github-actions released this 19 Oct 10:37
· 10 commits to main since this release

quickjs-oxide 0.3.1

Compilation takes time linear in the size of the source, code compiled at run time is reclaimed, and peak memory is lower.

Compilation

The handler table is built in one pass, name lookups use indexes, and source positions are located in one forward pass. Compile throughput on a 4 MB source rises from 1.03 to 5.46 MB/s (mixed syntax) and from 5.49 to 6.80 MB/s (many functions); QuickJS 2026-06-04 compiles the same sources at 0.40 and 0.62 MB/s.

Memory

  • Code compiled at run time (eval, the Function constructors, modules loaded while the program runs) is freed with its inline caches, atoms and RegExp programs once nothing refers to it. It counts toward the heap cap.
  • The collector budgets the heap at max(min_heap, (1 + growth) × live), arenas allocate from bitmaps, the value heap coalesces freed ranges, and arrays and constant tables take 3 × 2^k sizes.
  • On Linux x86_64 the qjs functions that startup and the common paths run are linked together.

Peak RSS on the fixed-work programs, geometric mean against QuickJS 2026-06-04: 1.59×, from 1.96× before the heap changes (#161). An empty script takes 3.9 MiB, from 4.8 MiB (QuickJS 3.2 MiB). Fixed-work CodeLoad, which compiles code at run time, peaks at 35.8 MiB instead of 122.3 MiB before #156.

Embedding API

  • Runtime::transient_compiler(), EvalOptions::transient() and CompileOptions::transient() compile code that is freed like eval's, such as a REPL's lines. Runtime::compiler() keeps compiled code for the life of the runtime.
  • MemoryReport splits static and dynamic code units and reports dynamic code bytes, RegExp program bytes, free cache entries, pinned atoms and the heap budget.

Install qjs

Prebuilt binaries for Linux (static musl), macOS and Windows are attached below.

# Prebuilt binary through cargo-binstall
cargo binstall --git https://github.com/pocket-nexus/quickjs-oxide quickjs-oxide-cli
# Build from source (Rust 1.99 or newer)
cargo install --locked --git https://github.com/pocket-nexus/quickjs-oxide --tag v0.3.1 quickjs-oxide-cli

WebAssembly

SHA256SUMS lists the digest of every attached file.

What's Changed

  • Build the compile probe without the removed feature list by @Eric-Song-Nop in #153
  • Compile in linear time: one-pass handler table, indexed names, fewer passes and allocations (#154, #155) by @Eric-Song-Nop in #160
  • Reclaim code compiled at run time, its caches and its atoms (#156) by @Eric-Song-Nop in #159
  • Lower peak memory: link order, a reserved-bytes budget, bitmap arenas, a coalescing value heap, smaller arrays by @Eric-Song-Nop in #161

Full Changelog: v0.3.0...v0.3.1