Repository navigation
perf(macos): 集成终端 Metal 渲染 - #265
Merged
Merged
Conversation
Collaborator
Author
|
这个改动的主要目的是因为在使用终端进行 AI 对话的时候发现异常的部分情况下非常的卡顿,然后检查相关信息之后发现目前的终端使用的是 CPU 重绘的方式,因此在大量日志输出的时候会感觉到明显的卡顿,这个 PR 模仿 Ghostty 使用 GPU 来进行相关的渲染,虽然会导致高速输出的时候 CPU 的消耗变多,但是基本不会出现卡顿,稳定在 58fps~60fps,远超之前的高输出的时候只有 38~46fps 的时候,而且个人认为后面这个 CPU 消耗还是可以优化的 |
Collaborator
Author
|
@lithe review |
1 similar comment
Collaborator
Author
|
@lithe review |
Contributor
Lithe Review结论: ✅ 未发现明确问题(LGTM) 验证
|
1lck
approved these changes
Aug 26, 2026
15 of 18 tasks
8 of 27 tasks
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.
摘要
具体调整
LitheTerminalView初始化时配置.perRowPersistentMetal 缓冲模式。setUseMetal(true),确保 SwiftTerm 的CAMetalLayer已具备有效窗口环境。preview.sh中复制SwiftTerm_SwiftTerm.bundle。SwiftTerm_SwiftTerm.bundle/Shaders.metal。影响范围
本次改动影响 macOS 终端的渲染后端以及应用资源打包流程。终端会话、PTY 进程、标签页切换和命令执行行为保持不变。
Metal 不可用或初始化失败时,终端会继续通过 Core Graphics 渲染,不会阻止终端使用。
测试环境
26A5421a)arm6417F113)rustc 1.96.0详细验证数据
最新
preview基线上的最终验证最终提交:
45329b43 perf(macos): 集成终端 Metal 渲染基线提交:
8694dbf1 Merge pull request #261 from 1lck/codex/fix-folded-code-vision-layout服务和构建边界
运行:
结果:
package-app.sh和preview.sh均通过 SwiftTerm Metal 资源打包规则检查macOS 测试
运行:
结果:
构建日志同时确认 SwiftPM 已处理:
应用包和 DMG 验证
运行:
结果:
lithe-coreRelease 构建通过lithe-db-sidecarRelease 构建通过lithe-db-mcpRelease 构建通过codesign --verify --deep --strict通过SwiftTerm_SwiftTerm.bundle/Shaders.metal存在性检查通过macOS package and disk image verification passed for arm64最终打包身份信息:
变基前验证
在基线
47e511d8上也完成过一轮完整验证:./scripts/verify-service-boundaries.sh:通过./scripts/test-macos.sh./scripts/verify-macos-package.shlithe-coreRelease 构建:38.86 秒lithe-db-sidecarRelease 构建:1 分 22 秒lithe-db-mcpRelease 构建:4.94 秒远端
preview更新后,分支已变基至8694dbf1,并重新执行上述最终验证。性能数据说明
本 PR 已验证 Metal 渲染接入、回退行为的编译路径以及 Shader 在最终应用包中的完整性。当前验证不包含 FPS、CPU 占用或 GPU 帧时间的量化基准,因此不在本 PR 中声明具体性能提升比例。
已知非阻塞警告
lithe-core/src/git/mod.rs中一处unused_mut警告,与本次终端改动无关。hdiutil create和hdiutil imageinfo输出 macOS 工具弃用提示,但 DMG 创建及镜像验证均成功。