Fix UI lag from unthrottled high-frequency event monitoring #1027
+56
−0
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.
After 5-7 days of runtime, trackpad scrolling and mouse interactions become severely laggy. Root cause:
EZEventMonitorprocesses hundreds ofNSEventMaskMouseMovedandNSEventMaskScrollWheelevents per second without throttling, accumulates event arrays indefinitely, and leaks delayed operations.Changes
Event throttling
Memory management
dismissPopButton: Clear event arrays, reset throttle timestampsstop: Cancel pendingperformSelectorcalls, clear all stateImpact
Eliminates CPU accumulation over extended runtime. Trackpad scrolling most affected by scroll wheel event frequency.
Original prompt
This section details on the original issue you should resolve
<issue_title>🐞 反馈问题:App 运行时间长了,导致交互卡顿</issue_title>
<issue_description>### 请先确认以下事项:
问题描述
鼠标滑动的交互很卡顿
该问题是否可以稳定重现?
可重现
重现步骤
鼠标滑动,选择功能的时候,很卡顿
截图
运行日志(zip 文件)
暂无日志
期望结果
流畅的交互流畅的交互流畅的交互
解决方案(可选)
No response
设备型号 && 系统版本
M3 pro 15.1
是否愿意提交 PR 解决该问题?
<agent_instructions>根据用户的反馈评论,帮我仔细调查这个问题,并提供修复方案。</agent_instructions>
Comments on the Issue (you are @copilot in this section)
@tisfeng > 鼠标滑动,选择功能的时候,很卡顿这是什么意思,完全看不懂你的描述。
最怕遇到这种没头没脑的 issue 了,我们的时间不应该浪费在这种低级的问询上面。
@Jerry23011 @fengjinlong 是和 #17 一个问题吗 @tisfeng 明白你说的问题了,但我这边测试没有明显感觉到这个问题,还需要再观察看看。 @tisfeng > 只要使用時間長了,必然會卡頓(比如滾動等)这个有可能和内存问题有关 #81 ,等后面修复了再看看。
这个我没遇到过,不知道什么问题。。</comment_new>
<comment_new>@tisfeng
很奇怪的问题,可能是快捷键冲突了?option+a 是否被其他应用占据了?
如果 option+a 不行,建议修改为其他的快捷键。如果不需要它,也请清除这个快捷键,避免影响到其他应用。</comment_new>
<comment_new>@tisfeng
Easydict 显示 CPU 和内存占用都正常,但是会导致卡顿?这么奇怪 🥲</comment_new>
<comment_new>@tisfeng
感谢反馈,我们尝试来看看。这个问题很麻烦。</comment_new>
<comment_new>@tisfeng
头疼,暂时找不到问题所在,,要不咋们提供一个定时重启 Easydict 的脚本,来曲线救国一下? 😫</comment_new>
<comment_new>@tisfeng
感觉有可能是【划词后自动显示查询图标】划词功能有影响,如果开启了它,这个功能会触发的比较频繁,但理论上应该也不会导致卡顿,对于划词功能,我们测过这部分性能,对 CPU 和内存都影响不大。
macOS 系统的开发文档不够完善,可能有很多我们没注意到的坑 😥
如果有遇到这个莫名卡顿问题的用户,请尝试关闭这个鼠标划词功能,改用快捷键划词试试。</comment_new>
<comment_new>@tisfeng
这么奇怪吗,外设鼠标不会,而触控板会导致卡顿。。。
稍后我们会仔细排查一遍这个问题。</comment_new>
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.