Skip to content

fix(msdf): release lock during GetBatch MSDF generation (#431) - #476

Merged
kolkov merged 1 commit into
mainfrom
fix/getbatch-perf
Aug 6, 2026
Merged

fix(msdf): release lock during GetBatch MSDF generation (#431)#476
kolkov merged 1 commit into
mainfrom
fix/getbatch-perf

Conversation

@kolkov

@kolkov kolkov commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • GetBatch held write lock during entire MSDF generation (440ms for 95 glyphs)
  • Now matches Get()'s lock discipline: generate outside lock, WLock only for insertion
  • Expected ~7x improvement for cache-miss workloads

Test plan

  • All 120+ msdf tests pass (including concurrent)
  • Lint clean
  • No API changes

Fixes #431

GetBatch held write lock during entire MSDF generation phase (440ms for
95 glyphs). Now matches Get()'s lock discipline: RLock for cache lookup,
generate MSDFs outside any lock, WLock only for fast atlas insertion.

Expected ~7x improvement for cache-miss workloads (440ms → ~62ms).
@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.77778% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
text/msdf/atlas.go 77.77% 3 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@kolkov
kolkov merged commit 488190a into main Aug 6, 2026
10 of 11 checks passed
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.

MSDF AtlasManager.GetBatch is inefficient

1 participant