Chez Scheme
By Cisco Systems / open-source community
Chez Scheme is a high-performance implementation of the Scheme programming language featuring an incremental native-code compiler that generates optimized machine code directly, rather than interpreting or compiling to an intermediate…
Definition
Chez Scheme is a high-performance implementation of the Scheme programming language featuring an incremental native-code compiler that generates optimized machine code directly, rather than interpreting or compiling to an intermediate bytecode. It is known for fast startup, low memory overhead, and compiled-code performance competitive with statically compiled languages, and today serves as the runtime underneath Racket's compiler and virtual machine.
Overview
Chez Scheme was built around a specific goal: make Scheme programs run as fast as programs written in more conventional statically compiled languages, without giving up Scheme's dynamic, interactive development style. Many Scheme and Lisp implementations of its era chose to interpret code or compile to bytecode for portability and simplicity; Chez instead compiles every expression, including code typed interactively at a REPL, straight to native machine instructions, which is the source of both its speed and its historically smaller footprint. Mechanically, Chez's incremental compiler processes each top-level form as it is entered, applying a battery of optimizations, inlining, constant folding, representation analysis for numeric types, and register allocation, before emitting native code for the host CPU architecture. Its garbage collector is a generational, copying collector tuned for the allocation patterns typical of functional Scheme code, where large numbers of small, short-lived objects are the norm. Because compilation happens per-form rather than per-file, a Chez REPL feels as interactive as a purely interpreted system while still executing compiled code. Among Scheme implementations, Chez sits at the performance-focused end of the spectrum, generally outperforming more portable or embeddable implementations like Guile or Chicken Scheme on compute-heavy benchmarks, at the cost of historically supporting fewer target platforms than implementations that compile to portable C. It differs from Racket, a Scheme-family language with its own large ecosystem and IDE, primarily in scope: Chez is a leaner, standards-focused Scheme, while Racket layers a much larger language and tooling ecosystem on top, and since Racket's "Racket-on-Chez" transition, Racket has actually adopted Chez as its underlying execution engine. In practice, Chez is used both as a standalone Scheme for performance-sensitive functional programming and, increasingly, as infrastructure: it compiles and runs Racket programs at the bytecode level, meaning many Racket users depend on Chez without directly writing Chez code. It also sees use in academic and research settings exploring compiler techniques, since its source has long served as a reference for how to build a genuinely fast Scheme compiler. The main limitation for newcomers is a smaller surrounding ecosystem than more package-rich languages: fewer third-party libraries exist compared to mainstream languages, and documentation assumes familiarity with Scheme and R6RS/R7RS conventions. Teams choosing Chez for a new project trade a large package ecosystem for compiled-code performance and a compact, well-understood implementation. This trade-off is deliberate rather than accidental: Chez's designers optimized for a small, auditable codebase and predictable performance characteristics, not for the breadth of third-party tooling that a mainstream language community accumulates over decades, so adopting it is a choice to prioritize execution speed and implementation clarity over ecosystem convenience.
Key Features
- Incremental compiler that generates native machine code per top-level form
- Generational, copying garbage collector tuned for functional allocation patterns
- Compiled-code performance competitive with statically compiled languages
- Fast startup and low memory overhead relative to bytecode-based Schemes
- Serves as the underlying execution engine for the Racket language
- Supports R6RS and much of R7RS Scheme standards
- Interactive REPL that still executes fully compiled native code
- Long history as a reference implementation for Scheme compiler design