navid/veins / 4e72d654a1f017a6cbf849ea41b63a801608fc41ae3dca253dca25ba334de5c6 / xveins/bench/core_bench.md
core_bench.md
← xveins/bench · 4074 bytes · raw · download
Showing source. View rendered.
Generated 2026-11-27 by `bench/core_bench.py`.
### Environment
| Implementation | Binary |
| :------------- | :---------------------------------- |
| Rust | `veins-rust v0.1.0 (veins-store 1)` |
| C++ | `veins v0.0.1 (veins-store 1)` |
| Spectre | `veins v0.0.1 (veins-store 1)` |
```
host: Darwin arm64
cpu: Apple M2
repeats: 5 (median reported)
cpu pinning: no
```
### Scope
The Rust binary implements the local-core subset: `init`, `status`, `log`, `go`/`commit`, `co`/`checkout`, `bmk set|ls|rm`, `self-test`, and `version`.
It uses the same FastCDC parameters, BLAKE3 object IDs, zstd level 1, pack/index layout, operation log, and stat-cache invalidation window as the reference.
The subset does not implement merge/conflict objects, rebase/undo, the git bridge, ignore files, or the network protocol. The workload below contains no renames, ignores, merges, or network traffic, so the measured local operations are directly comparable.
### Workload
- Base snapshot: 2.95 MiB, 42 files.
- 20 edit/commit revisions, 8 checkouts, 5 repeats, median reported.
- Each revision rewrites about 1% of a 120,000-line generated C file and three small module files.
- Each `go` performs the same snapshot, describe, and new-empty-change sequence as the reference, including all operation-log writes.
- Store size includes `.veins` packs, indexes, operation heads, the native commit map, and the stat cache.
### Summary
| Metric | Rust | C++ | Spectre | C++ / Rust | Spectre / Rust |
| :----------------- | ------------------: | ------------------: | ------------------: | ---------: | -------------: |
| Commit total [s] | 0.252 (0.250-0.262) | 0.280 (0.279-0.291) | 0.310 (0.309-0.330) | 1.11x | 1.23x |
| Checkout total [s] | 0.162 (0.161-0.165) | 0.175 (0.172-0.179) | 0.181 (0.179-0.196) | 1.08x | 1.12x |
| Store size [MiB] | 8.28 (8.28-8.37) | 8.28 (8.28-8.37) | 10.60 (10.60-10.69) | 1.00x | 1.28x |
Each cell is the median with the observed min-max range in parentheses.
A ratio above 1 means the other implementation took longer or used more space than Rust.
### Repeats
| Repeat | Rust commit [s] | C++ commit [s] | Spectre commit [s] | Rust checkout [s] | C++ checkout [s] | Spectre checkout [s] |
| :----- | --------------: | -------------: | -----------------: | ----------------: | ---------------: | -------------------: |
| 1 | 0.262 | 0.291 | 0.330 | 0.165 | 0.172 | 0.195 |
| 2 | 0.250 | 0.280 | 0.310 | 0.162 | 0.172 | 0.196 |
| 3 | 0.252 | 0.281 | 0.309 | 0.161 | 0.179 | 0.179 |
| 4 | 0.252 | 0.279 | 0.309 | 0.162 | 0.175 | 0.179 |
| 5 | 0.257 | 0.280 | 0.311 | 0.165 | 0.177 | 0.181 |
### Notes
- Both implementations use the same FastCDC parameters, BLAKE3 object IDs, zstd level 1, pack/index layout, operation log, and stat-cache racy window.
- Each `go` performs the same snapshot, describe, and new-empty-change sequence in both implementations, including three operation writes.
- The Rust subset omits ignore-file parsing and similarity-based rename detection. This workload has neither ignore files nor renames, so both implementations see the same file set and perform the same exact-rename scan.
- Rust and C++ store sizes are equal at this resolution; Spectre stores the same logical history with a different packing policy.
- This is a single-machine run. Treat differences below roughly 5% as noise.
### Reproduce
```sh
cd veins-rust
cargo build --release
cd ../veins-cpprewrite
python3 bench/core_bench.py --repeats 5 --markdown-out bench/core_bench.md
```