Skip to content

Benchmarks

Categoryvs harfbuzzjsvs opentype.jsvs freetype2
Path Extraction16x faster10x faster-
SVG Generation1.1x faster5x faster-
Latin Shaping1.5x faster22x faster-
Cyrillic Shaping1.2-1.4x faster17-56x faster-
CJK Shaping1.3-1.5x faster11-13x faster-
Arabic Shaping1.2x faster86x faster-
Hebrew Shaping1.6x faster33x faster-
Hindi Shaping3.6x faster11x faster-
Thai Shaping2x faster12x faster-
Myanmar Shaping10.5x faster17x faster-
Khmer Shaping2.1x faster8x faster-
UI Simulation4.8x faster--
Rasterization--1.6-11x faster
Cache Benefits---
MacBook Pro M1 Pro16 GBBun 1.3.3text-shaper 0.1.3

Glyph Paths

16x faster than HarfBuzz, 10x faster than opentype.js for path extraction.

Extract 10 glyph paths
text-shaper
831.3k ops/s
opentype.js
86.8k ops/s
harfbuzzjs
52.4k ops/s
SVG path generation (10 glyphs)
text-shaper
77.5k ops/s
harfbuzzjs
71.3k ops/s
opentype.js
14.2k ops/s

Text to SVG

Full text-to-SVG pipeline including shaping and path generation. 1.2-1.5x faster than HarfBuzz, 4-6x faster than opentype.js.

Hello World
text-shaper
54.1k ops/s
harfbuzzjs
45.0k ops/s
opentype.js
12.1k ops/s
Paragraph (87 chars)
text-shaper
11.4k ops/s
harfbuzzjs
7.8k ops/s
opentype.js
1.8k ops/s

Text Shaping

Basic Shaping

LTR text (no features)
text-shaper
410.4k ops/s
harfbuzzjs
179.4k ops/s
liga + kern features
text-shaper
277.7k ops/s
harfbuzzjs
208.7k ops/s
Many features
text-shaper
204.5k ops/s
harfbuzzjs
186.2k ops/s

Cyrillic Scripts

1.2-1.4x faster than HarfBuzz across Russian, Ukrainian, and Belarusian. 17-56x faster than opentype.js.

Russian paragraph (1001 chars)
text-shaper
22.0k ops/s
harfbuzzjs
18.4k ops/s
opentype.js
761 ops/s
Ukrainian paragraph (788 chars)
text-shaper
27.9k ops/s
harfbuzzjs
22.7k ops/s
opentype.js
1.2k ops/s
Belarusian paragraph (712 chars)
text-shaper
36.2k ops/s
harfbuzzjs
26.0k ops/s
opentype.js
647 ops/s

CJK Scripts

1.3-1.5x faster than HarfBuzz for CJK text, 11-13x faster than opentype.js.

Chinese Simplified (329 chars)
text-shaper
63.5k ops/s
harfbuzzjs
43.5k ops/s
opentype.js
4.8k ops/s
Japanese (418 chars)
text-shaper
43.8k ops/s
harfbuzzjs
33.7k ops/s
opentype.js
3.3k ops/s
Korean (449 chars)
text-shaper
34.9k ops/s
harfbuzzjs
25.5k ops/s
opentype.js
3.1k ops/s

Latin Scripts

1.5x faster than HarfBuzz, 22x faster than opentype.js for Latin text.

English paragraph (1056 chars)
text-shaper
7.9k ops/s
harfbuzzjs
5.3k ops/s
opentype.js
363 ops/s

RTL Scripts

1.2-1.6x faster than HarfBuzz for Arabic and Hebrew. 33-100x faster than opentype.js.

Arabic paragraph (1121 chars)
text-shaper
4.3k ops/s
harfbuzzjs
3.6k ops/s
opentype.js
42 ops/s
Hebrew paragraph (1220 chars)
text-shaper
12.9k ops/s
harfbuzzjs
7.8k ops/s
opentype.js
387 ops/s

Complex Scripts

TextShaper outperforms HarfBuzz on Indic and Southeast Asian scripts, 8-17x faster than opentype.js.

Hindi paragraph (1275 chars)
text-shaper
5.0k ops/s
harfbuzzjs
1.4k ops/s
opentype.js
456 ops/s
Myanmar paragraph (1916 chars)
text-shaper
4.0k ops/s
harfbuzzjs
380 ops/s
opentype.js
230 ops/s
Khmer paragraph (1128 chars)
text-shaper
4.7k ops/s
harfbuzzjs
2.2k ops/s
opentype.js
575 ops/s
Thai paragraph (1301 chars)
text-shaper
5.6k ops/s
harfbuzzjs
2.8k ops/s
opentype.js
452 ops/s

Greek

1.2x faster than HarfBuzz, 28x faster than opentype.js for Greek text.

Greek paragraph (997 chars)
text-shaper
21.4k ops/s
harfbuzzjs
17.5k ops/s
opentype.js
750 ops/s

Caching Performance

Shape plan caching provides significant speedups for repeated shaping.

Repeated Shaping - Hello
text-shaper
695.6k ops/s
harfbuzzjs
486.6k ops/s
(first call)
57.0k ops/s
Repeated Shaping - paragraph (85 chars)
text-shaper
80.2k ops/s
harfbuzzjs
61.3k ops/s
(first call)
16.4k ops/s
Glyph Path Cache
text-shaper
15.8M ops/s
(first call)
3.4k ops/s

Real-World Simulations

UI Simulation - 8 labels with paths
text-shaper
95.5k ops/s
harfbuzzjs
20.0k ops/s
Document Simulation - 4 paragraphs
text-shaper
36.7k ops/s
harfbuzzjs
33.7k ops/s

Rasterization

Compared against FreeType2 (WebAssembly). TextShaper is 1.6-11x faster at all sizes.

12px grayscale (5 glyphs)
text-shaper
18.5k ops/s
freetype2
11.4k ops/s
24px grayscale (5 glyphs)
text-shaper
39.0k ops/s
freetype2
16.6k ops/s
48px grayscale (5 glyphs)
text-shaper
26.8k ops/s
freetype2
6.4k ops/s
96px grayscale (5 glyphs)
text-shaper
13.3k ops/s
freetype2
2.0k ops/s
200px grayscale (5 glyphs)
text-shaper
6.8k ops/s
freetype2
614 ops/s

Render Modes

LCD subpixel (24px)
text-shaper
38.8k ops/s
freetype2
14.3k ops/s
Hinted (12px)
text-shaper
71.7k ops/s
freetype2
19.9k ops/s

Throughput

62 glyphs at 16px
text-shaper
3.5k ops/s
freetype2
435 ops/s
Varying sizes - 15 sizes per iteration
text-shaper
10.9k ops/s
freetype2
2.5k ops/s
Very large - 5 glyphs at 200px
text-shaper
6.8k ops/s
freetype2
614 ops/s

OpenType Features

No features - mixed text
harfbuzzjs
58.3k ops/s
text-shaper
55.5k ops/s
Standard ligatures (liga)
text-shaper
177.5k ops/s
harfbuzzjs
108.2k ops/s
Kerning pairs
harfbuzzjs
178.5k ops/s
text-shaper
108.0k ops/s
Small caps (smcp)
text-shaper
213.8k ops/s
harfbuzzjs
183.6k ops/s
Oldstyle figures (onum)
harfbuzzjs
276.4k ops/s
text-shaper
273.9k ops/s
Tabular figures (tnum)
text-shaper
355.0k ops/s
harfbuzzjs
192.6k ops/s
Fractions (frac)
text-shaper
322.2k ops/s
harfbuzzjs
175.2k ops/s
All common features (liga + kern + calt)
harfbuzzjs
101.1k ops/s
text-shaper
89.0k ops/s

Grapheme Clusters

Count graphemes - ASCII (11 chars)
text-shaper
335.4k ops/s
Count graphemes - emoji simple (5 graphemes)
text-shaper
3.2M ops/s
Count graphemes - emoji ZWJ (8 graphemes)
text-shaper
659.2k ops/s
Count graphemes - Devanagari (8 graphemes)
text-shaper
632.2k ops/s
Count graphemes - mixed (25 graphemes)
text-shaper
243.7k ops/s
Split graphemes - emoji ZWJ (8 graphemes)
text-shaper
548.7k ops/s