[PR #6950] [MERGED] perf(entropy): separate physical reads from report resolution #7472

Closed
opened 2026-11-01 21:48:05 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/6950
Author: @gensokyo-dev
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/24/2026
Merged by: @gensokyo-dev

Base: main ← Head: perf/6947-byte-entropy-reads-20261024


📝 Commits (6)

  • daa1c6f perf(entropy): separate physical reads from report blocks
  • 4afc4dc test(entropy): type the injected positional short-read boundary
  • 3ed3276 test(entropy): retain full catalog transport capacity in task probe
  • cf2d621 docs(perf): record real entropy task costs and limits
  • d290e5a chore: integrate current main for entropy verification
  • 1d55e27 docs(perf): record latest-main entropy qualification

📊 Changes

7 files changed (+1973 additions, -7 deletions)

View changed files

➕ experiments/analysis-efficiency/byte-entropy-costs.py (+94 -0)
➕ experiments/analysis-efficiency/byte-entropy-oracle.py (+56 -0)
➕ experiments/analysis-efficiency/byte-entropy-reads.json (+1430 -0)
➕ experiments/analysis-efficiency/byte-entropy-reads.md (+158 -0)
➕ experiments/analysis-efficiency/byte-entropy-reads.mjs (+154 -0)
📝 src/application/binaryDiagnostics/ByteEntropyService.test.ts (+64 -0)
📝 src/application/binaryDiagnostics/ByteEntropyService.ts (+17 -7)

📄 Description

Summary

Fixes #6947. A 256-byte report block previously forced 256-byte physical reads across an entire file, even outside a small selected window. On real LLVM 16 this required 481,955 reads. The shared CLI/MCP service now fills a bounded 64 KiB buffer and reports the same caller-selected blocks (1,885 reads).

Three alternating production MCP tasks per lane/case show fine-resolution LLVM whole-task medians 29.842 → 8.584 s and 25.286 → 6.358 CPU s. Kernel family peak increases 629.5 → 672.4 MiB; no memory or token saving is claimed. Large-block and small-file controls do not establish stable whole-task acceleration (small-file elapsed median is worse, with overlapping ranges). Reproducible measurements and limits.

Contract and scope

  • Owner: ByteEntropyService, at physical file reading. Existing static-inspection authority; maintainer execution/mutation scope decision is not applicable.
  • CLI/MCP catalog, inputs, capacity limits and outputs stay identical. All selected blocks, complete file hash/entropy, uncertainty and source Evidence survive; no cache or provider dependency added.
  • Existing file admission, identity validation, short-read completion, cancellation, finalization and cleanup retry remain owned by the same service. New regressions cover unaligned windows across buffers, short reads and tails at 256/4096/65536-byte report sizes.
  • Generated metadata/package/install behavior is unchanged. Real verification uses Linux x64 byte reads only; other filesystems/OSes are unverified.

Validation

  • 18 fresh production stdio tasks plus 6 real CLI calls: independent Python histograms/hash/block/run oracle, equal complete report hashes/parent IDs/catalog, and complete source Evidence exports passed.
  • 36 focused source/MCP-boundary tests passed; six serial static tasks and architecture guards passed. After integrating current main 21a20306b, all 36 tests, six static tasks and architecture guards passed again; 3 real MCP/source-export tasks and 3 CLI calls matched every oracle fact and frozen parent/report identity. Integrated test/preparation peak 2.23 GiB.
  • One-CPU quota, 3 GiB early stop/4 GiB hard, no swap; payload exit/cleanup and resource events verified, no OOM. Final whole-scope counters unavailable. Token values are serialized cl100k_base estimates, not model billing.

CI and review

CI 40063693805 failed on four observed baseline test identities, all reproduced on exact CI main 21a20306b; three available assertion first lines match, while one canceled case has no final CI assertion message. Two built shards passed, one failed and five were canceled, leaving incomplete broader coverage. Source reported 17,303 passed / 2 failed / 13 skipped. Static/build/Windows and the three real Linux binary/crash lanes passed. Exact-head Codex review completed with no findings. Full attribution, controls and limits.

The full local baseline control additionally had two 30-second negotiation timeouts; these are retained and are not attributed to CI. A targeted rerun reproduced the two observed built-case failures. Bypass is authorized by the requester; full-suite success is not claimed. Fresh actual-merge qualification follows integration.

Author readiness

Human owner: @gensokyo-dev

The requester explicitly authorized ready PRs, merging, baseline-CI bypass with evidence, and waiver of repeat human declarations. The following human attestations remain unchecked; this agent does not claim human review occurred.

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/6950 **Author:** [@gensokyo-dev](https://github.com/gensokyo-dev) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@gensokyo-dev](https://github.com/gensokyo-dev) **Base:** `main` ← **Head:** `perf/6947-byte-entropy-reads-20261024` --- ### 📝 Commits (6) - [`daa1c6f`](https://github.com/morluto/rea/commit/daa1c6f26131dc5c0e7e1a3bbdee6d4c97de4e73) perf(entropy): separate physical reads from report blocks - [`4afc4dc`](https://github.com/morluto/rea/commit/4afc4dcba9da85ad16437de97a0d0138ed4ad823) test(entropy): type the injected positional short-read boundary - [`3ed3276`](https://github.com/morluto/rea/commit/3ed3276d0ee79c291e1006901ace5b06626c1d4e) test(entropy): retain full catalog transport capacity in task probe - [`cf2d621`](https://github.com/morluto/rea/commit/cf2d62128706b540738bbe50318ab6d5be2e35d6) docs(perf): record real entropy task costs and limits - [`d290e5a`](https://github.com/morluto/rea/commit/d290e5a12dc8f946b63950580b110ba9d428b865) chore: integrate current main for entropy verification - [`1d55e27`](https://github.com/morluto/rea/commit/1d55e277ad052985d519a8f8fdfea4753089263d) docs(perf): record latest-main entropy qualification ### 📊 Changes **7 files changed** (+1973 additions, -7 deletions) <details> <summary>View changed files</summary> ➕ `experiments/analysis-efficiency/byte-entropy-costs.py` (+94 -0) ➕ `experiments/analysis-efficiency/byte-entropy-oracle.py` (+56 -0) ➕ `experiments/analysis-efficiency/byte-entropy-reads.json` (+1430 -0) ➕ `experiments/analysis-efficiency/byte-entropy-reads.md` (+158 -0) ➕ `experiments/analysis-efficiency/byte-entropy-reads.mjs` (+154 -0) 📝 `src/application/binaryDiagnostics/ByteEntropyService.test.ts` (+64 -0) 📝 `src/application/binaryDiagnostics/ByteEntropyService.ts` (+17 -7) </details> ### 📄 Description ## Summary Fixes #6947. A 256-byte report block previously forced 256-byte physical reads across an entire file, even outside a small selected window. On real LLVM 16 this required 481,955 reads. The shared CLI/MCP service now fills a bounded 64 KiB buffer and reports the same caller-selected blocks (1,885 reads). Three alternating production MCP tasks per lane/case show fine-resolution LLVM whole-task medians **29.842 → 8.584 s** and **25.286 → 6.358 CPU s**. Kernel family peak increases **629.5 → 672.4 MiB**; no memory or token saving is claimed. Large-block and small-file controls do not establish stable whole-task acceleration (small-file elapsed median is worse, with overlapping ranges). [Reproducible measurements and limits](https://github.com/morluto/rea/blob/1d55e277ad052985d519a8f8fdfea4753089263d/experiments/analysis-efficiency/byte-entropy-reads.md). ## Contract and scope - Owner: `ByteEntropyService`, at physical file reading. Existing static-inspection authority; maintainer execution/mutation scope decision is not applicable. - CLI/MCP catalog, inputs, capacity limits and outputs stay identical. All selected blocks, complete file hash/entropy, uncertainty and source Evidence survive; no cache or provider dependency added. - Existing file admission, identity validation, short-read completion, cancellation, finalization and cleanup retry remain owned by the same service. New regressions cover unaligned windows across buffers, short reads and tails at 256/4096/65536-byte report sizes. - Generated metadata/package/install behavior is unchanged. Real verification uses Linux x64 byte reads only; other filesystems/OSes are unverified. ## Validation - 18 fresh production stdio tasks plus 6 real CLI calls: independent Python histograms/hash/block/run oracle, equal complete report hashes/parent IDs/catalog, and complete source Evidence exports passed. - 36 focused source/MCP-boundary tests passed; six serial static tasks and architecture guards passed. After integrating current main `21a20306b`, all 36 tests, six static tasks and architecture guards passed again; 3 real MCP/source-export tasks and 3 CLI calls matched every oracle fact and frozen parent/report identity. Integrated test/preparation peak 2.23 GiB. - One-CPU quota, 3 GiB early stop/4 GiB hard, no swap; payload exit/cleanup and resource events verified, no OOM. Final whole-scope counters unavailable. Token values are serialized `cl100k_base` estimates, not model billing. ## CI and review [CI 40063693805](https://github.com/morluto/rea/actions/runs/40063693805) failed on four observed baseline test identities, all reproduced on exact CI main `21a20306b`; three available assertion first lines match, while one canceled case has no final CI assertion message. Two built shards passed, one failed and five were canceled, leaving incomplete broader coverage. Source reported 17,303 passed / 2 failed / 13 skipped. Static/build/Windows and the three real Linux binary/crash lanes passed. Exact-head Codex review completed with no findings. [Full attribution, controls and limits](https://github.com/morluto/rea/pull/6950#issuecomment-6380264655). The full local baseline control additionally had two 30-second negotiation timeouts; these are retained and are not attributed to CI. A targeted rerun reproduced the two observed built-case failures. Bypass is authorized by the requester; full-suite success is not claimed. Fresh actual-merge qualification follows integration. ## Author readiness Human owner: @gensokyo-dev The requester explicitly authorized ready PRs, merging, baseline-CI bypass with evidence, and waiver of repeat human declarations. The following human attestations remain unchecked; this agent does not claim human review occurred. - [ ] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [ ] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [ ] I declare this PR ready for initial maintainer review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:48:05 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7472
No description provided.