Repository navigation
perf(text): cache glyph advances per fixed-size font face - #114
Merged
sudoevolve merged 1 commit intoOct 21, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Closes #113。最新 dev
ad7e9e7的文字测量对每个字符重复FT_Load_Glyph,相同字形也反复解析轮廓;短文、长文、输入框重排和Emoji都受影响。先完成本地修复及重复性能验证,再创建 issue 和本 PR。修改
性能与正确性
同机3轮交错A/B、每case预热5次/统计60次,CFF与随包TTF,20.272/46.336物理px。普通文字/长文/Emoji的测量中位耗时约快10–75倍;CFF长混排 4.962→0.183ms,短混排 0.053→0.0024ms。3000个不同汉字 9.874→9.791ms,不宣称此类工作集有显著加速。72组caret位置及UTF-8索引指纹前后完全一致。峰值RSS略增,缓存预算及全部p50/p95见
docs/text-measurement-performance.md和原始JSONL。下游仍有页面历史组合开销,本PR不将测量收益宣称为全页面帧率保证。
影响
4文件:修改1、新增3、删除0;+388/-9行(含144行原始统计);追踪内容净增34593 bytes(33.8 KiB)。无新增依赖、资源、二进制或生成代码。
本机环境
Ubuntu24.04.5 / Linux7.0.0-38 x86_64;Intel Core Ultra5 225H(14核)、30GiB内存;GCC13.3、CMake3.28.3、Release -O3。后端运行在私有Xvfb,Mesa25.2.8 llvmpipe LLVM20.1.2;未据此声称硬件GPU或Windows实机性能。
验证
首轮四矩阵并行测试共享了image_cache夹具的固定临时路径,SDL2/Vulkan一项失败;隔离各自TMPDIR/XDG后完整四组36/36通过,没有修改或跳过失败用例。基准在编译/回归结束后运行。方法、原始数据和限制均随PR提交。