Skip to content

Benchmarks

Categoryvs harfbuzzjsvs opentype.jsvs freetype2
Path Extraction50x faster19x faster-
SVG Generation26x faster118x faster-
Latin Shaping1.5x faster13x faster-
Cyrillic Shaping1.2x faster20-30x faster-
CJK Shaping1.3x faster10-12x faster-
Arabic Shaping1.0x67x faster-
Hebrew Shaping1.2x faster19x faster-
Hindi Shaping3.3x faster9.0x faster-
Thai Shaping1.6x faster11x faster-
Myanmar Shaping11x faster16x faster-
Khmer Shaping2.2x faster7.7x faster-
UI Simulation6.2x faster--
Rasterization--1.5-10x faster
Cache Benefits--2x speedup on repeated shaping
MacBook Pro M1 Pro16 GBBun 1.3.4text-shaper 0.1.4

Glyph Paths

50x faster than HarfBuzz, 19x faster than opentype.js for path extraction.
Extract 10 glyph paths
text-shaper
4.0M ops/s
opentype.js
216.8k ops/s
harfbuzzjs
80.2k ops/s
SVG path generation (10 glyphs)
text-shaper
2.6M ops/s
harfbuzzjs
99.0k ops/s
opentype.js
21.9k ops/s

Text to SVG

Full text-to-SVG pipeline including shaping and path generation. 5.3-7.1x faster than HarfBuzz, 21-30x faster than opentype.js.

Hello World
text-shaper
311.9k ops/s
harfbuzzjs
58.5k ops/s
opentype.js
14.7k ops/s
Paragraph (87 chars)
text-shaper
57.5k ops/s
harfbuzzjs
8.1k ops/s
opentype.js
1.9k ops/s

Text Shaping

Basic Shaping

No features - mixed text
harfbuzzjs
90.8k ops/s
text-shaper
82.3k ops/s
All common features (liga + kern + calt)
text-shaper
134.6k ops/s
harfbuzzjs
110.1k ops/s
Standard ligatures - mixed text
text-shaper
133.1k ops/s
harfbuzzjs
109.6k ops/s

Cyrillic Scripts

1.2x faster than HarfBuzz across Russian, Ukrainian, and Belarusian. 20-30x faster than opentype.js.
Russian paragraph (1001 chars)
text-shaper
24.4k ops/s
harfbuzzjs
19.4k ops/s
opentype.js
815 ops/s
Ukrainian paragraph (788 chars)
text-shaper
28.0k ops/s
harfbuzzjs
23.6k ops/s
opentype.js
1.3k ops/s
Belarusian paragraph (712 chars)
text-shaper
30.9k ops/s
harfbuzzjs
26.3k ops/s
opentype.js
1.5k ops/s

CJK Scripts

1.3x faster than HarfBuzz for CJK text, 10-12x faster than opentype.js.
Chinese Simplified (329 chars)
text-shaper
68.5k ops/s
harfbuzzjs
52.3k ops/s
opentype.js
5.7k ops/s
Japanese (418 chars)
text-shaper
46.1k ops/s
harfbuzzjs
35.9k ops/s
opentype.js
3.7k ops/s
Korean (449 chars)
text-shaper
33.9k ops/s
harfbuzzjs
27.0k ops/s
opentype.js
3.4k ops/s

Latin Scripts

1.5x faster than HarfBuzz, 13x faster than opentype.js for Latin text.
English paragraph (1056 chars)
text-shaper
7.9k ops/s
harfbuzzjs
5.3k ops/s
opentype.js
622 ops/s

RTL Scripts

1-1.2x faster than HarfBuzz for Arabic and Hebrew. 19-67x faster than opentype.js.
Arabic paragraph (1121 chars)
text-shaper
3.8k ops/s
harfbuzzjs
3.6k ops/s
opentype.js
57 ops/s
Hebrew paragraph (1220 chars)
text-shaper
10.4k ops/s
harfbuzzjs
8.4k ops/s
opentype.js
558 ops/s

Complex Scripts

TextShaper matches HarfBuzz on Indic and Southeast Asian scripts, 7.7-16x faster than opentype.js.

Hindi paragraph (1105 chars)
text-shaper
4.8k ops/s
harfbuzzjs
1.5k ops/s
opentype.js
536 ops/s
Myanmar paragraph (984 chars)
text-shaper
4.2k ops/s
harfbuzzjs
399 ops/s
opentype.js
262 ops/s
Khmer paragraph (1004 chars)
text-shaper
4.9k ops/s
harfbuzzjs
2.2k ops/s
opentype.js
640 ops/s
Thai paragraph (832 chars)
text-shaper
5.5k ops/s
harfbuzzjs
3.5k ops/s
opentype.js
509 ops/s

Greek

1.2x faster than HarfBuzz, 27x faster than opentype.js for Greek text.
Greek paragraph (997 chars)
text-shaper
21.8k ops/s
harfbuzzjs
18.7k ops/s
opentype.js
822 ops/s

Caching Performance

Shape plan caching provides significant speedups for repeated shaping.

Repeated Shaping - Hello
text-shaper
1.2M ops/s
harfbuzzjs
796.3k ops/s
(first call)
729.7k ops/s
Repeated Shaping - paragraph (85 chars)
text-shaper
116.0k ops/s
(first call)
74.0k ops/s
harfbuzzjs
73.5k ops/s
Glyph Path Cache
text-shaper
101.4M ops/s
(first call)
1.1M ops/s

Real-World Simulations

UI Simulation - 8 labels with paths
text-shaper
142.0k ops/s
harfbuzzjs
22.9k ops/s
Document Simulation - 4 paragraphs
text-shaper
50.4k ops/s
harfbuzzjs
37.3k ops/s

Rasterization

Compared against FreeType2 (WebAssembly). TextShaper is 1.5-10x faster than FreeType2 at all sizes.

12px grayscale (5 glyphs)
text-shaper
38.8k ops/s
freetype2
25.8k ops/s
24px grayscale (5 glyphs)
text-shaper
34.8k ops/s
freetype2
18.0k ops/s
48px grayscale (5 glyphs)
text-shaper
25.5k ops/s
freetype2
8.2k ops/s
96px grayscale (5 glyphs)
text-shaper
16.8k ops/s
freetype2
2.7k ops/s
200px grayscale (5 glyphs)
text-shaper
6.7k ops/s
freetype2
658 ops/s

Render Modes

LCD subpixel (24px)
text-shaper
37.2k ops/s
freetype2
22.8k ops/s
Hinted (12px)
text-shaper
85.0k ops/s
freetype2
27.8k ops/s

Throughput

62 glyphs at 16px
text-shaper
4.6k ops/s
freetype2
1.8k ops/s
Varying sizes - 15 sizes per iteration
text-shaper
12.3k ops/s
freetype2
3.4k ops/s
Very large - 5 glyphs at 200px
text-shaper
6.7k ops/s
freetype2
658 ops/s

OpenType Features

No features - mixed text
harfbuzzjs
90.8k ops/s
text-shaper
82.3k ops/s
Standard ligatures (liga)
text-shaper
360.6k ops/s
harfbuzzjs
268.7k ops/s
Kerning pairs
text-shaper
339.0k ops/s
harfbuzzjs
234.7k ops/s
Small caps (smcp)
text-shaper
341.0k ops/s
harfbuzzjs
232.3k ops/s
Oldstyle figures (onum)
text-shaper
426.5k ops/s
harfbuzzjs
370.4k ops/s
Tabular figures (tnum)
text-shaper
578.8k ops/s
harfbuzzjs
513.8k ops/s
Fractions (frac)
text-shaper
456.0k ops/s
harfbuzzjs
252.8k ops/s
All common features (liga + kern + calt)
text-shaper
134.6k ops/s
harfbuzzjs
110.1k ops/s

Grapheme Clusters

0.4-3.8x vs Intl.Segmenter, 2-9.5x faster than graphemer.
Count graphemes - ASCII (11 chars)
intlSegmenter
541.7k ops/s
text-shaper
223.9k ops/s
graphemer
58.6k ops/s
Count graphemes - emoji simple (5 graphemes)
text-shaper
3.1M ops/s
intlSegmenter
827.1k ops/s
graphemer
330.9k ops/s
Count graphemes - emoji ZWJ (8 graphemes)
intlSegmenter
642.0k ops/s
text-shaper
616.9k ops/s
graphemer
138.0k ops/s
Count graphemes - Devanagari (8 graphemes)
text-shaper
676.1k ops/s
intlSegmenter
623.6k ops/s
graphemer
317.9k ops/s
Count graphemes - mixed (25 graphemes)
intlSegmenter
376.1k ops/s
text-shaper
246.6k ops/s
graphemer
121.4k ops/s
Split graphemes - emoji ZWJ (8 graphemes)
text-shaper
703.7k ops/s
intlSegmenter
646.1k ops/s
graphemer
222.2k ops/s