Skip to content

perf(deps): go-opentype/opentype v0.21.1, glyph outlines decoded once - #411

Merged
tannevaled merged 1 commit into
mainfrom
perf/opentype-0211
Nov 9, 2026
Merged

tannevaled merged 1 commit into
mainfrom
perf/opentype-0211

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

Bumps go-opentype/opentype to v0.21.1 (go-opentype/opentype#68): each glyph outline is decoded and flattened once per face, each sub-pixel phase is rasterised from it, flattenContour drops three copies, and the glyph, outline and phase caches are bounded (4096 glyphs, 16384 phased masks), so a hostile font cannot grow them.

  • BenchmarkRenderInlineFontFace: 1990 -> 1455 allocs/op (1659 before fix(paint): draw raster text at the exact size with a sub-pixel pen #408), 6450799 -> 6319468 B/op. Allocation counts are exact; timings are not claimed (load).
  • Output is unchanged: all goldens and TestRasterTextMatchesChromeWords (Chrome comparison) pass.
  • bench/go.mod tidied for the new version.

Closes #410

🤖 Generated with Claude Code

Sub-pixel raster text rasterised each glyph at up to four phases, decoding and
flattening its outline each time. v0.21.1 caches the flattened outline per
glyph and bounds the caches. BenchmarkRenderInlineFontFace: 1990 -> 1455
allocs/op (1659 before sub-pixel text). Output is unchanged.

Closes #410

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit 89e6294 into main Nov 9, 2026
13 checks passed
@tannevaled
tannevaled deleted the perf/opentype-0211 branch November 9, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: sub-pixel raster text adds 331 allocs/op to BenchmarkRenderInlineFontFace

1 participant