[1145] 工具栏重复重建性能优化:诊断插桩 + focus icons 缓存修复#4024
Draft
da-liii wants to merge 4 commits into
Draft
Conversation
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
get_menu_widget 记录 EQUAL/CACHE_HIT/MISS 计数并对 menu-expand、 make_menu_widget 计时;replaceButtons 记录 SAME/REPLACE 计数与耗时; get_qactionlist 计时。TeXmacs/tests/1145.scm 在真实 GUI 中驱动 连续输入与进出数学模式,MOGAN_TEST_GUI=1 xmake r 1145 复现观测。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
push-focus 给菜单项注入 (invisible (tree->path t)),路径随光标位置 变化,毒化 get_menu_widget 的展开结果判等,menu_cache 永远 MISS, 每次进入数学模式都全量 make_menu_widget(~41ms)并重建 QAction。 新增 scheme 函数 menu-cache-normalize 归一化展开结果中的 invisible 载荷;get_menu_widget 改用归一化 key 做判等与缓存索引。invisible 载荷本就不参与 widget 构建,行为零变化。实测重复进入数学模式 update_menus 从 166-173ms 降至 121-156ms。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
[1145]前缀日志)与 GUI 测试TeXmacs/tests/1145.scm(MOGAN_TEST_GUI=1 xmake r 1145),实测定位瓶颈为每次 update_menus 的 10 次 schememenu-expand(~75-110ms)get_menu_widget缓存判等改用归一化 key(新增 scheme 函数menu-cache-normalize,剔除invisible项载荷),重复进入数学模式时 which=2 从每次 MISS + make_menu_widget ~47ms 变为 CACHE_HIT 零重建Test plan
xmake b stemMOGAN_TEST_GUI=1 xmake r 1145(GUI 诊断日志观察)xmake r 1145(headless:menu-expand 判等诊断)🤖 Generated with Claude Code