Benchmarks

Estimated reading time: 2 minutes

Kita Html is a string builder. Its performance is measured by rendering the same component tree with each library and comparing time and memory.

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" use tagged template literals instead of JSX and produce larger output for the same logical content.

Methodology

The RealWorldPage benchmark is the most meaningful because it renders a full component tree. Template engines such as Ghtml and HonoHtml are faster because they concatenate template strings without a function call per element. In exchange, element and attribute names are not type-checked, and the kita-html check XSS diagnostics do not apply to them. Every JSX library pays one function call per element, so the JSX rows compare like with like.

Implementation details

The performance comes from building strings directly. 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.