Repository navigation
Epic(compare): 在 macOS 上对比 Lithe 与 GoLand、VS Code、Zed 的资源占用和 Go 交互延迟(不合入,基准测试集,后续基准测试perf/ide-comparison分支中进行补充) - #1997
Draft
xiaoyumuxi wants to merge 2 commits into
Draft
xiaoyumuxi wants to merge 2 commits into
xiaoyumuxi wants to merge 2 commits into
Conversation
ide-compare.mjs opens the Lithe repository in Lithe, GoLand, VS Code and Zed with new, isolated profiles and nothing installed, samples every launch with ide-compare-sampler-macos.c (phys_footprint per process tree and macOS responsibility, CPU time, windows), terminates the instance and checks nothing is left before the next launch. It writes results.json and a Markdown report: time to the project window, time to idle, steady and peak memory, idle CPU, processes, threads, install and profile size. First-run behaviour that would distort the numbers is turned off: update checks in every editor, GoLand's new UI tour (a modal dialog that holds back indexing) and its What's New page, and Zed's automatic HTML extension download. Profiles live in a short /tmp work directory because VS Code refuses socket paths over 103 bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ide-compare.mjs gains a Go mode (--go FILE --lithe-plugin ID): every editor also opens FILE, Lithe with the Go plugin the option names, copied as installed in Lithe on this machine (the scripts name no plugin themselves), Zed with its built-in Go support and GoLand as it ships. Lithe and Zed use the same gopls from PATH with a gopls cache of their own per launch. Memory and CPU are split into process groups so the language server's share is reported, and the sampler now records the CPU time of children a process waited for (childCpuUs), so short-lived go command children are counted. --source and --name compare another checkout, such as Kubernetes. ide-compare-latency.mjs times Go to Definition, hover, Find References and typing from the key press or pointer landing to the first changed frame and to a settled screen. ide-compare-input-macos.swift records the editor window with ScreenCaptureKit and sends CGEvent keys and pointer moves only while the editor is frontmost, discarding samples Mission Control or another window interrupted. Hovers use the mouse pointer, not F1: the pointer comes along the target line from two characters to the left, rests shorter than any editor's hover delay, then lands on the character found by stepping the caret. ide-compare-lsp-proxy.mjs sits between the editor and gopls and logs the server time of each request; hovers are matched by their position. scripts.md lists the three new scripts.
Repository owner
locked as too heated and limited conversation to collaborators
Nov 15, 2026
This branch has not been deployed
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
背景 / Why
我们需要一组可复现的数据,说明 Lithe 和常用编辑器相比的资源占用和交互速度,既用来对外介绍 Lithe,也用来对内发现性能退化。仓库里原来只有 Viva 编辑器自己的基准(
editor-bench.sh),没有办法在同一台机器上,用同样的项目和步骤,把 Lithe 和 GoLand、VS Code、Zed 放在一起比较。手工比较又没法复现:各编辑器的缓存、插件、窗口状态都不一样,计时只能靠肉眼。本 PR 在
scripts/desktop/perf/增加一组只在 macOS 本地运行的对比脚本(不进 CI),结果写到.artifacts/ide-compare/,报告用中文。改动 / Changes
资源对比:
ide-compare.mjs和ide-compare-sampler-macos.c(第一个提交 adf46f5)open -n,和从 Finder 打开一样。采样器按进程树和 macOS responsibility 汇总phys_footprint(和 Lithe 状态栏的算法一致),同时记录 CPU 时间和窗口。results.json和 Markdown 报告,内容包括:项目窗口出现时间、到空闲的时间、稳态和峰值内存、空闲 CPU、进程数、线程数、安装大小和 profile 大小。Go 模式:
ide-compare.mjs --go FILE --lithe-plugin ID(本次提交)--lithe-plugin指定的 Go 插件:照原样复制本机 Lithe 已安装的版本,并带上用户对这个版本的授权。脚本自己不写死任何插件 ID。GOPLSCACHE:第一次打开时是空的,相当于 GoLand 的索引。childCpuUs(ri_child_user_time + ri_child_system_time)。在两次采样之间启动又退出的子进程(例如 go 命令运行的编译器)也能算进 CPU 时间。已经统计过的进程退出时,它的时间不会再重复计入。--source DIR和--name NAME,可以用其他仓库做对比(例如 Kubernetes)。交互延迟:
ide-compare-latency.mjs、ide-compare-input-macos.swift、ide-compare-lsp-proxy.mjs(本次提交)--reps轮(默认 5 轮):其他
.agents/skills/develop-lithe/references/scripts.md:在scripts/desktop/perf/一行登记三个新脚本。不在本 PR 范围内 / Out of scope
git check-ignore,Kubernetes 上约 2,185 次。修复在 Rust Core,方案见 [Bug] 大型 Git 仓库中 Core 启动语言服务器前逐个目录执行 git check-ignore,Kubernetes 上 gopls 晚约 30 秒才启动 #1994。结果摘要 / Results
机器:Apple M4(10 核,24 GiB),macOS 27.3。版本:Lithe 0.7.0(本地 dist 包)、GoLand 2026.2.4、Zed 1.28.1,go1.27.4,gopls v0.23.0。
测量前做过两项预热,均对所有编辑器一致:
go mod download,以及用go build ./...预热 GOCACHE。机器保持空闲。完整报告由脚本生成,不提交(.artifacts/)。第一层:Lithe-IDEA 仓库,重新打开,中位数
第一层:Kubernetes(c50e5395f,31268 个文件),重新打开,中位数
Lithe 在 Kubernetes 上的 Go 就绪时间,大部分花在 gopls 启动之前(约 30 s):Core 在启动语言服务器前,为了算出要传给 gopls 的 Git 忽略目录,逐个目录启动
git check-ignore。原因和修复方案见 #1994。第二层:交互延迟,Lithe-IDEA 仓库,
desktop/internal/workbench/app.go,每项 5 轮semanticHoverDelay、Zedhover_popover_delay、GoLand 编辑器提示延迟。扣除后剩下的是编辑器自己的开销。后续改动请在后面进行补充,不要修改上面的内容