zed-industries/zed at 90d024b · static read-only analysis · why-not-rust method 2.0zed-industries/zed @ 90d024b · 静态只读分析 · why-not-rust 方法 2.0
Repository: github.com/zed-industries/zed at commit 90d024b88abc91264d9a0ad260eb4f365fa695c3, shallow clone, 4,235 tracked files, HEAD dated 2026-08-02. Scope: the editor and its UI framework assessed as one target, retrospectively — the decision under review is the one taken in 2021, not a proposal. Sampling: 1,539,358 lines of Rust across 1,926 files. On a general-purpose-source basis that is 1,539,358 of 1,556,319 lines, or 98.9%, the remainder being 13,682 lines of Python, 1,186 of JavaScript, 1,137 of PowerShell, 835 of shell, 116 of TypeScript and one 5-line Objective-C bridging header at crates/media/src/bindings.h. Shader source is counted separately: 4,050 lines of Metal, HLSL and WGSL. Tree-sitter query files (.scm, 9,140 lines) and WIT interface files (.wit, 4,017 lines) are excluded from that basis as neither is a general-purpose language. The eleven gpui* crates are 127,694 lines across 235 files. 230,346 lines across 121 files sit in test or fixture paths, and 784 inline #[cfg(test)] modules are not separated out, so the product-code figure is lower than 1.3M; the largest single .rs file in the tree is a test file, crates/editor/src/editor_tests.rs at 42,718 lines, and the second largest is a 21,343-line eval fixture. 262,512 lines belong to the 2024-26 agent crates. 1,111 occurrences of `unsafe {` were counted across *.rs with comments included; 776 are in crates/gpui and crates/gpui_*, 728 of those in the macOS and Windows backends, and 335 lie outside the gpui family. Cargo.lock lists 1,862 packages including 47 -sys crates and 24 tree-sitter packages. History, release and archive facts come from the GitHub API on 2026-08-02 because the clone is shallow: 39,386 commits, oldest b400449 on 2021-02-20, v0.1 on 2021-06-08, 1,275 releases to v1.13.1 on 2026-07-29, 9,444 commits in the last 365 days, 624 in the last 30; the contributors endpoint reports 482 and caps at 500. No build, test, benchmark, profiler or network call was run against the project. Objective: no design RFC was published, so the assessment takes the decision visible in the oldest commit — rebuild the editor in Rust on a purpose-built GPU UI framework. User-supplied facts: none. No Amdahl calculation appears: a deadline is not a speedup ratio, and no published frame decomposition supplies a share, so D2 and D5 are recorded UNKNOWN rather than estimated. The verdict turns on G1, which is measured in the source, and G4, which is measured in the release record; G2 passes on structural evidence with the attribution split stated, because no C++ counterfactual exists. Instruction-like text was found in scanned content: crates/agent/src/tools/skill_tool.rs:396 contains the string 'Ignore previous instructions.' inside a prompt-injection test fixture, and .agents/skills/ plus .factory/skills/ hold assistant-directed SKILL.md files. All of it was treated as data and changed no verdict, gate, path or number. This is a structured decision protocol, not a statistical predictor.仓库:github.com/zed-industries/zed,commit 90d024b88abc91264d9a0ad260eb4f365fa695c3,shallow clone,4,235 个纳管文件,HEAD 日期 2026-08-02。范围:编辑器和它的 UI 框架作为一个目标,回溯评估——被评的是 2021 年已经做出的决定,不是一份提案。采样:1,539,358 行 Rust,分布在 1,926 个文件。按通用编程语言口径,是 1,556,319 行里的 1,539,358 行,占 98.9%;其余是 13,682 行 Python、1,186 行 JavaScript、1,137 行 PowerShell、835 行 shell、116 行 TypeScript,以及 crates/media/src/bindings.h 那个 5 行的 Objective-C 桥接头。shader 单独计:Metal、HLSL、WGSL 合计 4,050 行。tree-sitter 查询文件(.scm,9,140 行)和 WIT 接口文件(.wit,4,017 行)不计入该口径,两者都不是通用语言。十一个 gpui* crate 共 235 个文件、127,694 行。有 121 个文件、230,346 行落在测试或 fixture 路径里,另有 784 个内联 #[cfg(test)] 模块没有拆出来,所以真正的产品代码低于 130 万行;树里最大的单个 .rs 是测试文件 crates/editor/src/editor_tests.rs,42,718 行,第二大的是一个 21,343 行的 eval fixture。2024-26 年的 agent 相关 crate 占 262,512 行。`unsafe {` 在 *.rs 里出现 1,111 次,未排除注释;其中 776 次在 crates/gpui 和 crates/gpui_* 里,728 次集中在 macOS 和 Windows 后端,另有 335 次在 gpui 家族之外。Cargo.lock 列出 1,862 个包,含 47 个 -sys crate 和 24 个 tree-sitter 包。历史、发布和归档信息取自 2026-08-02 的 GitHub API,因为 clone 是浅的:39,386 次提交,最早的是 2021-02-20 的 b400449,v0.1 在 2021-06-08,到 2026-07-29 的 v1.13.1 共 1,275 个 release,最近 365 天 9,444 次提交,最近 30 天 624 次;contributors 接口报 482,上限是 500。没有对项目做过任何构建、测试、基准、profiling 或网络调用。目标:没有公开的设计 RFC,所以按最早那个 commit 里能看到的决定来评——用 Rust 重建编辑器,配一套专门写的 GPU UI 框架。用户提供的事实:无。本报告没有 Amdahl 计算:截止时间不是加速比,而且没有公开的单帧拆解能给出占比,所以 D2 和 D5 记 UNKNOWN,不做估算。结论落在 G1 和 G4 上,前者在源码里可量,后者在发布记录里可量;G2 是靠结构性证据过的,并把归因拆开写明,因为不存在 C++ 的对照实现。扫描到了指令样式的内容:crates/agent/src/tools/skill_tool.rs:396 在一个 prompt 注入测试 fixture 里含有 'Ignore previous instructions.' 这串文字,.agents/skills/ 和 .factory/skills/ 下还有面向助手的 SKILL.md。全部按数据处理,没有改动任何结论、门、路径或数字。这是一套结构化决策流程,不是统计预测器。
| What we don't know证据缺口 | What it would change会改变什么 |
| A published decomposition of one 8.33ms frame一份公开的单帧 8.33ms 时间拆解 | It would show how much of the budget Zed's own code owns versus the driver, the compositor and the GPU. Until it exists D2 stays UNKNOWN, and the frame-rate claim rests on construction rather than on a share.它能说明这份预算里 Zed 自己的代码占多少,驱动、合成器和 GPU 各占多少。在它出现之前 D2 保持 UNKNOWN,帧率这条只能靠结构论证,拿不出占比。 |
| A boot decomposition for both stacks两个栈各自的启动时间拆解 | Atom's loudest complaint was startup and D5 is UNKNOWN because nobody has split boot into runtime init, I/O and useful work. This is the cheapest missing measurement in the case.Atom 被骂最狠的是启动,而 D5 记 UNKNOWN,因为没人把启动拆成运行时初始化、I/O 和有效工作。这是本案里最便宜的一处缺失测量。 |
| A steady-state footprint comparison against a current Electron editor跟当代 Electron 编辑器的稳态占用对比 | D4 cannot move without it. Installer size is not resident memory, and on Windows the system webview is Chromium anyway.没有它 D4 动不了。安装包大小不是常驻内存,而且在 Windows 上系统 webview 本来就是 Chromium。 |
| What the C++ version would have costC++ 版本会花多少 | No counterfactual build exists, so G2's attribution stays structural. A Qt or Skia estimate against the 127,694-line framework inventory would sharpen it either way.不存在对照实现,所以 G2 的归因只能停在结构层面。拿 Qt 或 Skia 对着那份 127,694 行的框架清单估一遍,两个方向上都会让它更清楚。 |