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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ jobs:
- name: Build workspace
run: cargo build --workspace --locked

- name: Native build cache workflow (Linux sandbox)
run: cargo nextest run --locked -p lpm-workflows --test native_build_cache --no-fail-fast --status-level slow --final-status-level fail

- name: Unit and integration tests (non-workflow, non-CLI)
run: cargo nextest run --locked --workspace --exclude lpm-workflows --exclude lpm-cli --no-fail-fast --status-level slow --final-status-level fail

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"generated_at": "2026-07-12T21:38:02.229Z",
"platform": "darwin-arm64",
"node": "v22.22.1",
"lpm_bin": "target/release/lpm-rs",
"fixture": "bench/audit-fixtures/native/sharp-image",
"samples": 10,
"artifact_count": 2,
"artifact_bytes": 503469,
"scenarios": {
"cache_miss": {
"samples": 10,
"wall_ms_median": 173.1,
"wall_ms_p95": 280,
"max_rss_bytes_median": 47169536,
"user_cpu_ms_median": 40,
"system_cpu_ms_median": 20,
"cache_hits": 0,
"cache_misses": 10,
"lifecycle_ms_avoided": 0
},
"local_hit": {
"samples": 10,
"wall_ms_median": 59.07,
"wall_ms_p95": 72.25,
"max_rss_bytes_median": 41631744,
"user_cpu_ms_median": 20,
"system_cpu_ms_median": 10,
"cache_hits": 10,
"cache_misses": 0,
"lifecycle_ms_avoided": 1049,
"speedup_vs_miss": 2.93,
"wall_reduction_percent": 65.88
},
"ci_warm_store_hit": {
"samples": 10,
"wall_ms_median": 58.49,
"wall_ms_p95": 61.69,
"max_rss_bytes_median": 41615360,
"user_cpu_ms_median": 10,
"system_cpu_ms_median": 10,
"cache_hits": 10,
"cache_misses": 0,
"lifecycle_ms_avoided": 1051,
"speedup_vs_miss": 2.96,
"wall_reduction_percent": 66.21
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Native lifecycle-build cache benchmark — NativeToolchain

- Platform: macOS arm64
- Node: v22.22.1
- Fixture: `bench/audit-fixtures/native/sharp-image`
- Release-build samples per scenario: 10
- Median build artifact size: 503,469 bytes

| Scenario | Median wall | p95 wall | Median RSS | User CPU | System CPU | Result |
|---|---:|---:|---:|---:|---:|---:|
| Strict cache miss | 173.10 ms | 280.00 ms | 47,169,536 B | 40 ms | 20 ms | 10 misses |
| Local artifact hit | 59.07 ms | 72.25 ms | 41,631,744 B | 20 ms | 10 ms | 2.93×; 65.88% lower wall time |
| Stable-path CI warm-store hit | 58.49 ms | 61.69 ms | 41,615,360 B | 10 ms | 10 ms | 2.96×; 66.21% lower wall time |

Every measured scenario used the same strict sandbox. Sharp follows the
`NativeToolchain` cache path, so every hit validates the persisted compiler,
SDK, package-database, pkg-config, Homebrew receipt, and Node-header snapshot.
The first measured miss computed the complete host fingerprint in 126 ms;
subsequent unchanged-host key derivations took 15–24 ms.
Miss and local-hit samples rematerialized the same project. CI-like samples
deleted and recreated a checkout at one stable path while retaining the warm
LPM store.

Across ten local hits, artifact metadata recorded 1,049 ms of lifecycle
execution avoided. Across ten stable-path CI hits, it recorded 1,051 ms
avoided. The measured hit remains beneficial after paying the conservative
host-snapshot validation cost.
49 changes: 49 additions & 0 deletions bench/perf-results/native-build-cache-20260712-macos-arm64.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"generated_at": "2026-07-12T13:19:13.671Z",
"platform": "darwin-arm64",
"node": "v22.22.1",
"lpm_bin": "target/release/lpm-rs",
"fixture": "bench/audit-fixtures/native/esbuild-prebuilt",
"samples": 10,
"artifact_count": 2,
"artifact_bytes": 134444,
"scenarios": {
"cache_miss": {
"samples": 10,
"wall_ms_median": 138.03,
"wall_ms_p95": 449.94,
"max_rss_bytes_median": 52248576,
"user_cpu_ms_median": 50,
"system_cpu_ms_median": 20,
"cache_hits": 0,
"cache_misses": 10,
"lifecycle_ms_avoided": 0
},
"local_hit": {
"samples": 10,
"wall_ms_median": 32.33,
"wall_ms_p95": 37.27,
"max_rss_bytes_median": 41467904,
"user_cpu_ms_median": 10,
"system_cpu_ms_median": 10,
"cache_hits": 10,
"cache_misses": 0,
"lifecycle_ms_avoided": 1356,
"speedup_vs_miss": 4.27,
"wall_reduction_percent": 76.58
},
"ci_warm_store_hit": {
"samples": 10,
"wall_ms_median": 29.5,
"wall_ms_p95": 30.12,
"max_rss_bytes_median": 41418752,
"user_cpu_ms_median": 10,
"system_cpu_ms_median": 10,
"cache_hits": 10,
"cache_misses": 0,
"lifecycle_ms_avoided": 1053,
"speedup_vs_miss": 4.68,
"wall_reduction_percent": 78.63
}
}
}
24 changes: 24 additions & 0 deletions bench/perf-results/native-build-cache-20260712-macos-arm64.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Native lifecycle-build cache benchmark

- Platform: macOS arm64
- Node: v22.22.1
- Fixture: `bench/audit-fixtures/native/esbuild-prebuilt`
- Release-build samples per scenario: 10
- Median build artifact size: 134,444 bytes

| Scenario | Median wall | p95 wall | Median RSS | User CPU | System CPU | Result |
|---|---:|---:|---:|---:|---:|---:|
| Strict cache miss | 138.03 ms | 449.94 ms | 52,248,576 B | 50 ms | 20 ms | 10 misses |
| Local artifact hit | 32.33 ms | 37.27 ms | 41,467,904 B | 10 ms | 10 ms | 4.27×; 76.58% lower wall time |
| Stable-path CI warm-store hit | 29.50 ms | 30.12 ms | 41,418,752 B | 10 ms | 10 ms | 4.68×; 78.63% lower wall time |

Every measured scenario used the same strict sandbox. Miss and local-hit
samples rematerialized the same project. CI-like samples deleted and recreated
a checkout at one stable path while retaining the warm LPM store; observable
lifecycle paths are part of the cache key, so moving a checkout intentionally
invalidates the artifact.

Across ten local hits, artifact metadata recorded 1,356 ms of lifecycle
execution avoided. Across ten stable-path CI hits, it recorded 1,053 ms
avoided. This fixture has a short lifecycle command; native compilation
workloads should have a substantially larger absolute hit benefit.
17 changes: 17 additions & 0 deletions bench/scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Install benchmark scripts

## Native lifecycle-build cache

Build the release CLI, then compare strict cache misses, local artifact hits,
and CI-like stable-path checkout recreation against sharp's NativeToolchain
cache path. Every measured scenario uses the same strict sandbox, so cache-hit
timings include host compiler, SDK, package database, and pkg-config
fingerprinting:

```bash
cargo build --release --locked -p lpm-cli --bin lpm-rs
node bench/scripts/native-build-cache-benchmark.mjs --self-test
node bench/scripts/native-build-cache-benchmark.mjs --samples 10
```

The harness writes raw rows plus JSON and Markdown summaries under
`bench/perf-results/native-build-cache-<timestamp>/`.

## Production-readiness harness

`run-install-readiness.mjs` is the current install-readiness harness. It is
Expand Down
Loading
Loading