prisma/prisma-engines at 9bae2a3 · static read-only analysis · why-not-rust method 2.0prisma/prisma-engines 于 commit 9bae2a3 · 只读静态分析 · why-not-rust 方法 2.0
Repository: github.com/prisma/prisma-engines at commit 9bae2a3, shallow clone, 2,794 tracked files. Scope: the query-execution path. Sampling: 394,195 lines of Rust across 1,647 files. query-engine/ holds 100,992 lines and now contains only connectors and a connector test kit — no engine binary and no node-api crate exists anywhere in the workspace. query-compiler/ holds 43,995 lines including query-compiler-wasm; schema-engine/ holds 135,240. 68 files carry wasm in their path. 17 `unsafe` keyword occurrences, 12 outside comments, against 15 crate roots declaring #![deny(unsafe_code)]. Per-directory figures count .rs only, so they are comparable with the 394,195 total. No build, test, benchmark or network call was run against the project. Objective: cut ORM query latency and shipped bundle size for JavaScript and TypeScript applications including edge runtimes. User-supplied facts: none. Amdahl/boundary inputs: share=1.0, kernel speedup=infinite, boundary=2.3636, target=1.0 → end-to-end 0.4230834320528008x, infinite-kernel ceiling 0.4230834320528008x, target physically IMPOSSIBLE. The boundary figure comes from Prisma's published 185 ms (with Rust) and 55 ms (without) on a 25,000-row findMany, taking the TypeScript implementation as baseline: (185-55)/55 = 2.3636 in baseline-time units. This is the one case in the published set where the evidence points away from Rust on a performance objective. The finding concerns the shape of the boundary rather than the speed of the language, which is why 394,195 lines of Rust remain in the tree. This is a structured decision protocol, not a statistical predictor.仓库:github.com/prisma/prisma-engines,commit 9bae2a3,浅克隆,2,794 个受控文件。范围:查询执行路径。采样:Rust 共 394,195 行,分布在 1,647 个文件里。query-engine/ 有 100,992 行,现在只剩连接器和一套连接器测试工具——整个 workspace 里既没有引擎二进制,也没有 node-api crate。query-compiler/ 有 43,995 行,含 query-compiler-wasm;schema-engine/ 有 135,240 行。路径里带 wasm 的文件 68 个。`unsafe` 关键字出现 17 次,注释之外 12 次,对应 15 个 crate 根声明了 #![deny(unsafe_code)]。分目录数字只统计 .rs,因此可以和 394,195 的总数对齐。没有对项目执行任何构建、测试、基准或网络调用。目标:降低 JavaScript 和 TypeScript 应用的 ORM 查询延迟与发布产物体积,含边缘运行时。用户提供的事实:无。Amdahl/边界输入:share=1.0,kernel speedup=infinite,boundary=2.3636,target=1.0 → 端到端 0.4230834320528008x,内核无穷快时的天花板 0.4230834320528008x,目标在物理上 IMPOSSIBLE。边界数值来自 Prisma 公布的 25,000 行 findMany 数据:带 Rust 185 ms,不带 55 ms;以 TypeScript 实现为基线,(185-55)/55 = 2.3636 个基线时间单位。在已发布的这批案例里,只有这一次证据在性能目标上指向「不要 Rust」。结论说的是边界的形态,而不是语言的速度,所以树里还留着 394,195 行 Rust。这是一套结构化决策流程,不是统计预测器。
| What we don't know证据缺口 | What it would change会改变什么 |
| A published benchmark harness for the 185/55 ms pair185/55 ms 这一对数字缺公开的测量脚手架 | The figures are first-party. An independent reproduction would move D1 and D2 from strong-with-caveat to fully checkable. The structural constraints stand either way.这两个数是一方给的。有人独立复现,D1 和 D2 就能从「强但有保留」变成完全可核对。结构性约束无论如何都在。 |
| A measured batched-boundary variant批量边界的版本没有实测 | Nobody published a Rust engine with batched, zero-copy crossings. Until one exists, 'keep Rust and tune the boundary' is excluded on distribution grounds and not on latency.没有人公布过采用批量、零拷贝跨界的 Rust 引擎。在它出现之前,「保留 Rust、调边界」只能以分发理由排除,延迟上排除不了。 |
| Per-operation crossing count for other workloads其他负载的单次操作跨界次数 | The 2.36× figure belongs to this query shape at this call frequency. Any transfer requires the target's own crossing count.2.36× 这个数字属于这种查询形态、这个调用频率。要搬到别处,先数清楚目标自己的跨界次数。 |