Back to Projects
TUIX v0.2.0Beta

Last Updated: 2026-05-20

Performance

TUIX Core is designed for high throughput. The compiled C core handles rendering, compositing, and input, while the Python layer manages configuration and orchestration.

Benchmark Summary

Benchmarks measured on Windows 10, 12th Gen Intel Core i5-12450HX, 24GB RAM.

ScenarioMean LatencyOps/secPeak RSS
Startup302 µs3,3113.9 MB
Tree Construction (10 items)110 µs9,1263.9 MB
Tree Construction (100 items)104 µs9,6353.9 MB
Tree Construction (1000 items)97 µs10,3094.0 MB
Re-render (no changes)10 µs96,1543.9 MB
Content Update134 µs7,4633.9 MB
Layout Stress (10×4 grid)1,142 µs8764.0 MB
Scroll Stress (2000 items)112 µs8,9294.1 MB
Virtual List (100K items)70 µs14,38818.3 MB

Rendering Optimizations

Delta Rendering

The renderer only processes rows that changed between frames. Each row is hashed using FNV-1a on the raw pixel data (before color quantization). Unchanged rows are skipped entirely — no quantization, no SGR emission, no output.

Color Quantization LUT

A 128KB precomputed lookup table maps RGB565 (65,536 entries) to the closest terminal color in ANSI16, ANSI256, or truecolor. The LUT is built once on the first render call, then all color matching is O(1) per pixel.

SGR Grouping

Consecutive pixels with identical foreground color, background color, and style flags are grouped into a single SGR (Select Graphic Rendition) escape sequence. This reduces the amount of escape code bytes emitted per row.

Chunked Output

Rendered ANSI output is accumulated in a 256KB buffer and flushed in chunks. This reduces the number of write() system calls and improves throughput on both Windows and POSIX.

Scene Pointer Caching

The main loop caches the active scene pointer across frames. Scene names are interned strings compared by pointer rather than value, making the per-frame scene lookup O(1).

Memory Profile

TUIX Core has a small memory footprint. Base RSS at startup is approximately 3.9 MB. Memory growth is primarily driven by the number of pixels in active buffers. A full-screen canvas at 120×30 uses approximately 120 × 30 × sizeof(TuixPixel) bytes.

Comparisons

TUIX Core was benchmarked against several terminal UI frameworks across languages:

FrameworkLanguageTree 1000 ItemsRe-renderPeak RSS
TUIX.CorePython/C97 µs10 µs3.9 MB
RatatuiRust125 µs3.2 MB
Bubble TeaGo311 µs11.2 MB
blessedNode.js5,800 µs124 µs152 MB
InkNode.js (React)3,200 µs87 MB
Full BenchmarksSee BENCHMARKS.md in the repository for detailed results across all 25 scenarios, including per-frame statistics, memory profiling, and PTY byte measurements.

Running Benchmarks

# Full benchmark suite (25 scenarios, outputs JSON + CSV)
python tests/benchmarks/full_benchmark.py

# Micro scene benchmark (command buffer execution speed)
python tests/benchmarks/micro_scene_bench.py

The full benchmark outputs benchmark.json, benchmark_summary.csv, and benchmark_frames.csv. The micro benchmark measures per-object command buffer execution cost in microseconds.