Skip to content

Commit 16338af

Browse files
committed
test(perf): measure public analysis costs and pin real artifacts
1 parent 42b0ed1 commit 16338af

4 files changed

Lines changed: 787 additions & 0 deletions

File tree

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Analysis efficiency measurements
2+
3+
Tracks the experiments for [#2016](https://github.com/morluto/rea/issues/2016).
4+
The production CLI/MCP contracts and defaults remain the compatibility baseline.
5+
Downloaded artifacts, runtime copies, exported Evidence, transcripts and raw
6+
measurements belong outside the checkout.
7+
8+
## Reproduce a measurement
9+
10+
Use the repository's pinned Node/npm and locked dependencies. Build each selected
11+
revision, then copy its `dist/`, `bridge/`, `scripts/`, `skills/`, `package.json`
12+
and `package-lock.json` to a separate runtime directory before editing production
13+
sources. That copy needs the matching locked dependencies. The initial frozen
14+
baseline is `42b0ed126df7d5b908ac369715378d5e519051b7`; this study does not
15+
silently substitute a newer `main` or the previous Code Mode experiment.
16+
17+
The public artifacts and acquisition digests are in `corpus.json`. Supply their
18+
actual local paths and an optional JSON object of explicit provider environment
19+
settings. Do not add credentials to that file. Provider settings are inherited
20+
by the child, but the report persists only the selected settings' digest. It
21+
does not serialize the ambient environment.
22+
23+
```sh
24+
export NODE_OPTIONS=--max-old-space-size=512
25+
export UV_THREADPOOL_SIZE=1
26+
export GOMAXPROCS=1
27+
export GOMEMLIMIT=2GiB
28+
python3 experiments/analysis-efficiency/resource-run.py -- \
29+
node experiments/analysis-efficiency/measure.mjs \
30+
--runtime-root /absolute/frozen-runtime \
31+
--revision 42b0ed126df7d5b908ac369715378d5e519051b7 \
32+
--artifact obsidian.asar --path /absolute/obsidian-1.14.4.asar \
33+
--providers /absolute/selected-providers.json \
34+
--output /absolute/new-measurement-directory
35+
```
36+
37+
The wrapper requires Linux cgroup v2 and a working user systemd manager. It owns
38+
a unique transient scope, restricts the whole process tree to one CPU, caps
39+
memory at 4 GiB with no swap and 192 tasks, and samples memory/tasks/CPU every
40+
100 ms. It stops its own scope above 3 GiB or below 4 GiB host available memory;
41+
startup requires 8 GiB available. Cleanup failures retain the owned scope's
42+
identity. Run heavy builds, providers and model trials serially. Sampled peaks
43+
can miss short spikes; cgroup limit events are separately reported.
44+
45+
## What the numbers mean
46+
47+
`summary.json` records the selected artifact's before/after SHA-256, runtime
48+
file-table digest, dispatcher and lockfile digests, runner source digest,
49+
Node/SDK versions, catalog sizes, caller arguments and producer Evidence IDs.
50+
`runtime-files.json` identifies the exact compiled files measured. Actual
51+
provider settings and runtime files must stay fixed during a comparison.
52+
53+
Every tool call measures three intervals at the public SDK Transport boundary:
54+
55+
- Client work before `send`, including first-use schema preparation.
56+
- Transport/server roundtrip, including framing, I/O, server work and client
57+
JSON parsing. This interval is **not** a Ghidra-only or provider-only timer.
58+
- Client work after the parsed response reaches `onmessage`.
59+
60+
The SDK call's total excludes the runner's subsequent encoding and disk writes.
61+
Result byte counts measure compact JSON of the parsed client result, not raw
62+
wire bytes or tokens. Progress notifications retain their actual arrival times;
63+
they do not imply more precise internal engine timings than the producer emits.
64+
Scope CPU time and aggregate process-tree memory come from the wrapper's final
65+
JSON line. Fresh processes have cold application caches; host page caches are
66+
not globally flushed.
67+
68+
`--delivery summary` is an explicit candidate workflow, initially for artifact
69+
inventory. It must be supported by the selected server's advertised schema.
70+
The default `complete` runs the existing calls unchanged. Compare the same
71+
analyst facts and complete source Evidence before crediting a smaller response.
72+
Projection can reduce delivery bytes without reducing upstream analysis time.
73+
74+
For a completed WASM result exceeding the MCP response budget, the runner keeps
75+
the original error, exports retained Evidence through the public tool, and
76+
authenticates the exact reported record using the selected runtime's parser.
77+
The report names this recovery; it does not relabel the oversized inline reply
78+
as successful delivery.
79+
80+
## Initial observations and exclusions
81+
82+
The frozen baseline has 2,326,609 bytes of complete catalog JSON, of which
83+
494,207 bytes describe names, descriptions and input schemas. One Obsidian
84+
trial spent about 21.9 s before the first request was sent, then about 0.77 s
85+
in that request's transport/server roundtrip. Other cold runs differed
86+
substantially. These single observations identify a measurement boundary;
87+
they do not establish a speedup or a distribution.
88+
89+
The initial matrix exercised shipped Obsidian, NewPipe, ShareX, OpenWrt, SQLite
90+
WASM and jq artifacts. SQLite produced a complete result larger than the
91+
transport frame and requires an explicit recovery run. A first jq attempt hit
92+
the SDK's default 60 s timeout because the experimental runner used a superseded
93+
three-argument call signature. SDK 2.3.1 accepts request options as argument two;
94+
the corrected jq run completed real Ghidra analysis in about 265 s. That earlier
95+
driver timeout is excluded from REA regression claims. Provisional runs with
96+
different runner source digests are not one paired statistical cohort.
97+
98+
No cross-session engine database cache, default analyzer changes, external
99+
plugin loading, or broad plugin SDK is enabled by this experiment.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
"schema_version": 1,
3+
"artifacts": [
4+
{
5+
"id": "sharex.dll",
6+
"file": "ShareX.dll",
7+
"bytes": 2162688,
8+
"sha256": "191a191be964e434daf0f9d76d1e0d8ddce90d7e248cba2a6b5ac9577f288d53",
9+
"provenance": {
10+
"project": "ShareX",
11+
"version": "19.0.2",
12+
"upstreamFile": "ShareX-19.0.2-portable.zip",
13+
"url": "https://github.com/ShareX/ShareX/releases/download/v19.0.2/ShareX-19.0.2-portable.zip",
14+
"transport_sha256": "967b5d838df5ce25fb5fd7cbd16f1bd797427e2df16907b022b74a4bc0fb9d54",
15+
"transport_bytes": 168796487,
16+
"derivation": "selected regular ZIP member ShareX.dll"
17+
}
18+
},
19+
{
20+
"id": "sqlite.wasm",
21+
"file": "sqlite3.wasm",
22+
"bytes": 868907,
23+
"sha256": "2ee8f3dab694532afc8840e07703127287662d08b74e6ff50491ce63f00d5752",
24+
"provenance": {
25+
"project": "SQLite Wasm",
26+
"version": "3.53.4-build1",
27+
"upstreamFile": "sqlite-wasm-3.53.4-build1.tgz",
28+
"url": "https://registry.npmjs.org/@sqlite.org/sqlite-wasm/-/sqlite-wasm-3.53.4-build1.tgz",
29+
"transport_sha256": "24f46db4ce5248fa8f8f24b67e81909ab1a9c152f42a4796a32c6d385a6fb62b",
30+
"transport_bytes": 977616,
31+
"transport_integrity": "sha512-U8pvL0patYHMgieD8JxxYJTlh9m1LUX8+BDYb7MiKQzBI89f2qbdmdcG/PvnPaLm9wsBbv4VlVG453ixnxBOnA==",
32+
"derivation": "selected regular tar member package/dist/sqlite3.wasm"
33+
}
34+
},
35+
{
36+
"id": "obsidian.asar",
37+
"file": "obsidian-1.14.4.asar",
38+
"bytes": 27477966,
39+
"sha256": "146ef8470d8cbb4a6db209bdc19bf2bad13350444186c0fd93c31087b142b92f",
40+
"provenance": {
41+
"project": "Obsidian",
42+
"version": "1.14.4",
43+
"upstreamFile": "obsidian-1.14.4.asar",
44+
"transport": {
45+
"file": "obsidian-1.14.4.asar.gz",
46+
"url": "https://github.com/obsidianmd/obsidian-releases/releases/download/v1.14.4/obsidian-1.14.4.asar.gz",
47+
"sha256": "d1ed428c363968774f0f3906e67d8a53a058ece0b6cdd924b07865977b2ada21",
48+
"bytes": 9200670
49+
},
50+
"derivation": "gzip decompression"
51+
}
52+
},
53+
{
54+
"id": "newpipe.apk",
55+
"file": "NewPipe_v0.29.1.apk",
56+
"bytes": 11507122,
57+
"sha256": "18447bfb1e06d113edc88df93f471827280de06f6f3d4dc42f56f28b9c1bab79",
58+
"provenance": {
59+
"project": "NewPipe",
60+
"version": "0.29.1",
61+
"upstreamFile": "NewPipe_v0.29.1.apk",
62+
"url": "https://github.com/TeamNewPipe/NewPipe/releases/download/v0.29.1/NewPipe_v0.29.1.apk"
63+
}
64+
},
65+
{
66+
"id": "jq",
67+
"file": "jq-linux-amd64",
68+
"bytes": 2267912,
69+
"sha256": "b1c22172dd303f3be49e935aa56aa48a8b7a46e0bc838b4997d3bb451495870f",
70+
"provenance": {
71+
"project": "jq",
72+
"version": "1.8.2",
73+
"upstreamFile": "jq-linux-amd64",
74+
"url": "https://github.com/jqlang/jq/releases/download/jq-1.8.2/jq-linux-amd64"
75+
}
76+
},
77+
{
78+
"id": "openwrt.bin",
79+
"file": "openwrt-25.12.5-ath79-generic-tplink_archer-c7-v5-squashfs-sysupgrade.bin",
80+
"bytes": 7405862,
81+
"sha256": "f15b16b36df7fce8a5cf1302320fdb428c3bb6fbc2949a4858afa257f4f364a2",
82+
"provenance": {
83+
"project": "OpenWrt Archer C7 v5",
84+
"version": "25.12.5",
85+
"upstreamFile": "openwrt-25.12.5-ath79-generic-tplink_archer-c7-v5-squashfs-sysupgrade.bin",
86+
"url": "https://downloads.openwrt.org/releases/25.12.5/targets/ath79/generic/openwrt-25.12.5-ath79-generic-tplink_archer-c7-v5-squashfs-sysupgrade.bin"
87+
}
88+
}
89+
]
90+
}

0 commit comments

Comments
 (0)