Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion PERFORMANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ for character, index in 'a☕中x' by 2 then sum += index
sum
```

signed-by-iteration(20,000 次):
signed-by-iteration(10,000 次):

```coffee
sum = 0
Expand Down Expand Up @@ -545,6 +545,8 @@ rest 绑定会复制剩余元素到新的不可变数组,以保持宿主存储

本次可复现实测在 Apple M1 Pro(T6000、16 GB 统一内存)、Darwin 25.5.0 上运行;编译器为 `rustc 1.94.0 (4a4ef493e 2026-03-02)`(完整 commit `4a4ef493e3a1488c6e321570238084b38948f6db`,LLVM 21.1.8),release 命令为 `cargo run --locked --release --bin qbench -- --json --iterations 100`。它得到 `signed-by-iteration` 一条记录:编译总计 `618750 ns`,验证总计 `28917 ns`,执行总计 `2363209 ns`,期望值为 `3333`。这是单次开发机样本,只用于确认工作负载已纳入语义护栏与性能采集;跨版本比较仍须按本报告口径重复至少三次并取中位数。

标准 `cargo bench --locked --bench core`(10,000 次)同样已纳入该负载;本次样本为编译 `38.544 ms`、验证 `2.032 ms`、执行 `157.776 ms`,期望值 `3333`。它与正向 `stepped-iteration` 的执行样本(`124.616 ms`)同场输出,便于观察有符号步进的额外边界检查成本。
Comment thread
tiye marked this conversation as resolved.

## RFC 0074 映射展开

在同一 Darwin arm64 开发机上,`cargo bench --bench core` 的 `map-spread` workload(20,000 次)单次样本为:编译 91.995 ms,验证 2.767 ms,执行 48.784 ms。映射展开为每个显式项生成单项映射,再由 `MergeMaps` 合并;后续键覆盖前值。
Expand Down
6 changes: 6 additions & 0 deletions benches/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ fn main() {
iterations: 10_000,
expected: "1617",
},
Workload {
name: "signed-by-iteration",
source: "sum = 0\nfor n, index in [1...100] by -3 then sum += n + index\nsum",
iterations: 10_000,
expected: "3333",
},
Workload {
name: "for-collection",
source: "values = for n in [1...100] when n % 3 == 0 then n * 2\nlen(values)",
Expand Down