Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsMay 23, 2026·3 min de lecture

QuickJS — Small Embeddable JavaScript Engine

Lightweight JavaScript engine by Fabrice Bellard supporting the ES2023 specification in a single C file with no external dependencies.

Prêt pour agents

Cet actif peut être lu et installé directement par les agents

TokRepo expose une commande CLI universelle, un contrat d'installation, le metadata JSON, un plan selon l'adaptateur et le contenu raw pour aider les agents à juger l'adaptation, le risque et les prochaines actions.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
QuickJS Overview
Commande CLI universelle
npx tokrepo install fbf50eca-56e5-11f1-9bc6-00163e2b0d79

Introduction

QuickJS is a small, embeddable JavaScript engine written in C by Fabrice Bellard, the creator of FFmpeg and QEMU. It supports the full ES2023 specification including modules, async/await, generators, proxies, and BigInt. The engine compiles to a single binary under 700 KB, making it ideal for embedding in applications, IoT devices, and plugin systems where V8 or SpiderMonkey would be too heavy.

What QuickJS Does

  • Executes standard-compliant JavaScript including ES modules and async functions
  • Compiles JavaScript to bytecode for faster startup and smaller distribution
  • Provides a C API for embedding the engine in native applications
  • Includes a standalone qjs interpreter and a qjsc bytecode compiler
  • Supports operator overloading and BigFloat extensions for mathematical computing

Architecture Overview

QuickJS uses a bytecode interpreter with a reference-counting garbage collector supplemented by cycle detection. The parser produces an AST that is compiled to compact bytecode in a single pass. The engine is contained in two main C files (quickjs.c and quickjs-libc.c) with no third-party dependencies. Memory usage is predictable because the reference counter frees objects immediately when they become unreachable, avoiding the pause-time variance of tracing collectors.

Self-Hosting & Configuration

  • Build from source with make on any POSIX system or use CMake for cross-compilation
  • Embed by linking quickjs.c into your C or C++ project and calling JS_NewRuntime()
  • Set memory limits with JS_SetMemoryLimit() to sandbox untrusted scripts
  • Compile scripts to bytecode with qjsc -o app script.js for faster cold starts
  • The quickjs-ng community fork adds CMake support and continuous CI testing

Key Features

  • Full ES2023 compliance verified against the official Test262 suite
  • Tiny footprint suitable for microcontrollers and WebAssembly targets
  • Deterministic memory management via reference counting
  • Fast startup compared to JIT-based engines on short-lived scripts
  • Permissive MIT license allows embedding in commercial products

Comparison with Similar Tools

  • V8 — JIT-compiled, high throughput but large binary and memory footprint; QuickJS is interpreted but tiny
  • SpiderMonkey — Mozilla engine with JIT; QuickJS trades peak speed for minimal size
  • Hermes — Meta engine optimized for React Native; QuickJS covers the full ES spec more completely
  • Duktape — another embeddable engine but targets ES5; QuickJS supports modern ES2023
  • MicroJS (mjs) — extremely minimal; QuickJS offers much broader spec coverage

FAQ

Q: How fast is QuickJS compared to V8? A: QuickJS is an interpreter without JIT, so it is slower on long-running compute. For short scripts and startup-sensitive use cases, the gap narrows.

Q: Can QuickJS run Node.js modules? A: QuickJS supports ES modules but does not include the Node.js standard library. Community projects like txiki.js add Node-compatible APIs.

Q: Is QuickJS suitable for production embedding? A: Yes. Its small size and deterministic GC make it a strong fit for plugin engines in games, databases, and network devices.

Q: What is quickjs-ng? A: A community-maintained fork that adds CMake builds, CI, and incremental improvements while tracking upstream releases.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires