Back to blog
·5 minEngineering

Performance Benchmarks — How UIX Delivers Speed

UIX Protocol is infrastructure. When your design tool, CI pipeline, and AI agents all depend on the same schema layer, it needs to be fast. Here's how UIX performs.

Design principles

Performance wasn't bolted on after the fact. Every module in UIX Protocol follows three rules:

  1. Zero unnecessary allocations. Immutable operations use structural sharing. Hot paths avoid object creation.
  2. Deterministic pipelines. The runtime's 9-step interpretation pipeline runs the same steps in the same order — no branching, no indirection.
  3. Stream-friendly. Diff computation, token resolution, and codegen all operate incrementally so they work in real-time collaboration contexts.

The numbers

OperationPerformanceContext
Schema validation<1msFull Zod parse of a UIXDocument with 50+ nodes
Diff engine<5msStructural diff between two document versions
Token resolution<0.5msResolve nested `{color.primary}` references across a full document
Code generation~50msGenerate React + Flutter + SwiftUI for a 50-node document
Runtime pipeline9 stepsDocument × Environment → Interpreted tree, deterministic
MCP tool dispatch<2msRoute and execute any of 58 MCP tools

Why these benchmarks matter

Schema validation: <1ms

Every UIXDocument is validated by Zod at runtime. This matters because documents are created, modified, and synced constantly — in Canvas, in CI pipelines, and by AI agents via MCP. Sub-millisecond validation means you get type safety without perceptible latency.

Diff engine: <5ms

computeDocumentDiff() compares two document versions and returns a structured diff — added nodes, removed nodes, modified properties. This runs on every sync cycle and every uix diff command. At <5ms, it's fast enough for real-time collaboration.

Code generation: ~50ms

@uix/codegen generates platform-native code from a UIXDocument. That includes React (.tsx), Flutter (.dart), SwiftUI (.swift), Vue (.vue), Angular (.ts), React Native (.tsx), and HTML (.html). Generating all seven targets from a 50-node document completes in roughly 50ms — fast enough to run in watch mode during development.

Runtime pipeline: 9 deterministic steps

The runtime interprets a UIXDocument through 9 sequential steps:

  1. Validate environment
  2. Resolve tokens
  3. Select variants
  4. Adapt physics
  5. Adapt chemistry
  6. Resolve layout
  7. Adapt interactions
  8. Validate bindings
  9. Resolve animations

Each step is a pure function. The pipeline emits events (step:start, step:complete) and supports strict mode where any error halts the pipeline. In default mode, warnings are collected and the pipeline completes gracefully.

How we maintain performance

  • Vitest benchmarks in critical paths — schema validation, diff, token resolution
  • No `any` types — strict TypeScript catches type coercion overhead at compile time
  • ESM only — tree-shaking eliminates dead code paths in production builds
  • Pure functions in @uix/protocol — no classes, no mutable state, no side effects in the foundation package

The takeaway

UIX Protocol processes a full UI schema in under 1ms. It generates code for 7 platforms in ~50ms. It diffs two document versions in <5ms. These aren't theoretical limits — they're the measured performance of the actual codebase running on commodity hardware.

When your schema layer is this fast, it disappears. You stop thinking about performance and start thinking about UI.