Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .cspell/words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,33 @@ direnv
envrc
esac
esbuild
fcntl
flac
ftyp
Ghostty
hakula
hakulattic
indoc
isom
kbytes
killpg
libiconv
libwebp
magick
Menlo
MSVC
ncpu
nixfmt
nixos
nixpkgs
nocapture
noindex
openpty
osascript
oxalica
pkgs
pname
Popen
rasterizes
rects
resvg
Expand All @@ -50,6 +56,7 @@ substituters
syntect
taiki
taplo
TIOCSWINSZ
tomllib
tspan
unpoisoned
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ A minimal, extensible Rust coding agent harness (`ox`) built for experienced eng
- **Minimal Rust core and language-agnostic extensions**

- Small, TUI-free Rust core (`ox-core`) with 4 built-in tools, SQLite session persistence, zero telemetry, and a workspace trust gate.
- Lightweight native footprint: 12.45 MiB stripped binary, 7.14 ms median `--version` startup, 12.03 MiB idle TUI RSS, and 171 µs full 120x40 frame draws on Apple M1 Pro (see [Performance](docs/reference/performance.md)).
- Process-isolated stdio JSON-RPC 2.0 plugins in any language for tools, commands, compaction, hooks, prompt sections, hints, and attachment converters (see [Building Plugins](docs/guides/building-plugins.md)).
- Out-of-process MCP (`ox-plugin-mcp`), keeping `ox-core` MCP-agnostic.

Expand Down
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Documentation for `oxide-code` (`ox`) is organized into three user-facing bucket
| [Compaction](reference/core/compaction.md) | Automatic and manual compaction, preservation, and session boundaries |
| [Configuration](reference/core/configuration.md) | `config.toml` layering, `package_roots`, providers, and model bindings |
| [Models](reference/core/models.md) | Data-driven model catalog TOML schema and tier profiles |
| [Performance](reference/performance.md) | Measured binary footprint, startup latency, RSS, and hot-path benches |
| [Sessions](reference/core/sessions.md) | SQLite session schema, `seq` invariants, and rewind semantics |
| [Steering](reference/core/steering.md) | Mid-stream steering channel, injection points, and persistence |
| [System Prompt](reference/core/system-prompt.md) | Named system prompt sections and declarative Markdown overrides |
Expand Down
75 changes: 75 additions & 0 deletions docs/reference/performance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
title: Performance
description: Measured binary footprint, startup latency, memory usage, and Criterion hot-path benchmarks for ox.
---

This page records measured binary size, startup latency, memory footprint, and Criterion microbenchmark numbers for `ox`, along with how to reproduce them locally.

## Methodology and Test Environment

All numbers on this page were collected with [`scripts/bench-footprint.nu`](../../scripts/bench-footprint.nu) against a release build of `ox` (`lto = true`, `codegen-units = 1`, `strip = true` in `Cargo.toml`).

- **Date**: 2026-12-06
- **Hardware**: Apple M1 Pro (8 cores, `arm64`)
- **OS**: macOS 27.2.1 (`26B131`)
- **Toolchain**: `rustc 1.100.1 (20ddd0171 2026-11-25)`

How each metric is measured:

- **Binary size**: Size of the resolved executable on disk in MiB, following symlinks and shell wrapper scripts to the underlying binary.
- **`--version` startup**: Median and p95 wall-clock time across 20 sequential invocations of `<cli> --version`.
- **`--version` peak RSS**: Median peak resident set size across 5 invocations using `/usr/bin/time -l` on macOS (bytes converted to MiB) or `/usr/bin/time -v` on Linux (KiB converted to MiB).
- **Idle PTY RSS**: Resident set size of `ox --no-session --model claude-sonnet-4-5 --trust` sampled via `ps -o rss=` after 1.5 seconds in a 120x40 PTY once the initial TUI frame renders.
- **Criterion hot paths**: Median point estimates from `cargo bench -p ox-core --bench hot_paths` and `cargo bench -p ox-tui --bench render` (100 samples per benchmark).

### Reproducing Locally

Run the benchmark script from the repository root inside the Nix development shell:

```bash
nix develop -c ./scripts/bench-footprint.nu --build --compare --criterion
```

Pass `--json` to emit machine-readable JSON, or omit `--compare` and `--criterion` for a quick footprint check of `ox` alone. Missing comparison CLIs on `PATH` are skipped automatically.

## CLI Footprint and Startup

The table below compares `ox` against other coding agent CLIs installed on the same host. These tools ship different architectures and runtimes: `ox` is a stripped native Rust binary with out-of-process extensions, `codex` is a larger native binary, and `claude` and `omp` are standalone Bun-compiled executables that bundle a JavaScript runtime. Because `--version` exits before initializing full interactive UIs, plugin hosts, or network clients, it measures baseline binary launch overhead.

| CLI | Version | Runtime / Packaging | Binary Size | `--version` Median | `--version` p95 | `--version` Peak RSS | Idle PTY RSS |
| -------- | ----------------------- | --------------------------- | ----------: | -----------------: | --------------: | -------------------: | -----------: |
| `ox` | `ox 0.2.0-alpha.1` | Native Rust (LTO, stripped) | 12.45 MiB | 7.14 ms | 8.27 ms | 7.13 MiB | 12.03 MiB |
| `claude` | `2.1.337 (Claude Code)` | Bundled Bun executable | 393.29 MiB | 18.56 ms | 21.06 ms | 20.28 MiB | n/a |
| `codex` | `codex-cli 0.174.0` | Native binary | 406.84 MiB | 13.49 ms | 15.37 ms | 14.06 MiB | n/a |
| `omp` | `omp/19.4.4` | Bundled Bun executable | 239.18 MiB | 16.20 ms | 20.62 ms | 29.84 MiB | n/a |

## Criterion Hot-Path Benchmarks

### `ox-core` Hot Paths

Benchmarks in [`crates/ox-core/benches/hot_paths.rs`](../../crates/ox-core/benches/hot_paths.rs) cover SSE wire framing, context compaction, model catalog loading, and skill frontmatter parsing.

| Group | Benchmark | Workload | Median |
| --------------------- | ------------------------------- | ----------------------------------------------------------------- | -------: |
| `ox_core/compaction` | `allocate_fair_budgets_64` | Fair budget allocation across 64 items | 202.3 ns |
| `ox_core/frontmatter` | `skill_parse` | Parse a `SKILL.md` frontmatter header and body | 634.5 ns |
| `ox_core/compaction` | `truncate_chars_with_marker` | UTF-8 character-safe truncation with marker | 1.46 µs |
| `ox_core/compaction` | `find_cut_point_48_msgs` | Locate compaction cut boundary in a 48-message session | 4.95 µs |
| `ox_core/compaction` | `extract_files_xml_and_prefix` | Extract read and modified file paths from session and summary XML | 6.06 µs |
| `ox_core/catalog` | `builtin` | Construct the built-in model catalog | 11.25 µs |
| `ox_core/catalog` | `from_toml_16_models` | Parse a 16-model TOML catalog definition | 24.00 µs |
| `ox_core/sse` | `openai_responses_64b_chunks` | Parse an OpenAI Responses SSE stream in 64-byte chunks | 46.91 µs |
| `ox_core/sse` | `anthropic_messages_64b_chunks` | Parse an Anthropic Messages SSE stream in 64-byte chunks | 66.13 µs |

### `ox-tui` Rendering Hot Paths

Benchmarks in [`crates/ox-tui/benches/render.rs`](../../crates/ox-tui/benches/render.rs) cover incremental Markdown rendering, full terminal frame drawing at 120x40, and SVG snapshot generation.

| Group | Benchmark | Workload | Median |
| ----------------- | ------------------------------------ | ----------------------------------------------------------------------- | --------: |
| `ox_tui/markdown` | `render_markdown_incremental_warm` | Warm incremental Markdown cache hit | 2.33 µs |
| `ox_tui/ui` | `render_populated_transcript_120x40` | Full Ratatui frame draw on a populated 4-turn transcript (120x40) | 171.12 µs |
| `ox_tui/svg` | `buffer_to_svg_120x40` | Render a 120x40 Ratatui buffer to SVG | 419.26 µs |
| `ox_tui/markdown` | `render_markdown_multi_block` | Cold full Markdown parse with GFM table and `syntect` Rust highlighting | 471.38 µs |

At 171.12 µs per full 120x40 frame draw and 2.33 µs for warm incremental Markdown updates, frame rendering stays well under a 16.67 ms (60 FPS) budget.
Loading
Loading