Benchmarks

Estimated reading time: 2 minutes

Kita Html is a string builder. The most representative way to measure its performance is through micro benchmarks that compare string generation speed against other HTML builders.

Results

Benchmarked on a 13th Gen Intel Core i5-13600K (~4.80 GHz) running Node.js v24.13.0 on 2026-02-23. Run pnpm bench in the repository root to reproduce.

RealWorldPage (170.5 KiB output)

LibraryAvg timeAvg memoryNotes
KitaJs361.79 µs1.83 mbbaseline
Preact806.05 µs3.09 mb2.2x slower
ReactJsx1.01 ms3.30 mb2.8x slower
React1.04 ms3.68 mb2.9x slower
HonoJsx1.05 ms3.14 mb2.9x slower
vHtml2.06 ms3.54 mb5.7x slower, different output
TypedHtml2.11 ms7.13 mb5.8x slower, different output
CommonTags3.58 ms6.30 mb9.9x slower, template engine
Jsxte3.95 ms13.94 mb10.9x slower, different output
Ghtml230.79 µs0.65 mbtemplate engine, 204.5 KiB
HonoHtml118.12 µs0.55 mbtemplate engine, 204.5 KiB

Libraries marked "different output" produce HTML that differs from React's output for the same input. Libraries marked "template engine" lack JSX syntax, so they have no per-call function overhead and produce a larger output for the same logical content.

Methodology

The RealWorldPage benchmark is the most meaningful, as it represents a realistic workload scenario with a full component tree. Template engines such as Ghtml and HonoHtml have an inherent advantage: with no function call per element and no JSX transform, they trade away syntax highlighting and editor intellisense. The JSX-based results reflect the actual cost incurred by any JSX library.

Why it is fast

The performance comes from the string-only architecture. There is no object tree construction, no diffing, and no serialization step. The runtime uses character-by-character loops for HTML escaping instead of regex replacements, checks before converting (regex test before expensive operations), and orders void element checks by frequency. When running on Bun, the runtime delegates escaping to Bun's native escapeHTML implementation.