-
Notifications
You must be signed in to change notification settings - Fork 0
Single-read verified hydration: drop redundant range re-read #87
Copy link
Copy link
Closed
Labels
area:hydrationHydration profiles and zero-copy/reference hydrationHydration profiles and zero-copy/reference hydrationenhancementNew feature or requestNew feature or requestpriority:p2Do after evidence or dependency gates; optional portability capabilityDo after evidence or dependency gates; optional portability capabilityv0.2.NEXTCommitted for a future 0.2.x release; not yet pinned to 0.2.4/0.2.5Committed for a future 0.2.x release; not yet pinned to 0.2.4/0.2.5v0.2.xHotMem post-v0.2 follow-up workHotMem post-v0.2 follow-up work
Milestone
Description
Activity
Metadata
Metadata
Assignees
Labels
area:hydrationHydration profiles and zero-copy/reference hydrationHydration profiles and zero-copy/reference hydrationenhancementNew feature or requestNew feature or requestpriority:p2Do after evidence or dependency gates; optional portability capabilityDo after evidence or dependency gates; optional portability capabilityv0.2.NEXTCommitted for a future 0.2.x release; not yet pinned to 0.2.4/0.2.5Committed for a future 0.2.x release; not yet pinned to 0.2.4/0.2.5v0.2.xHotMem post-v0.2 follow-up workHotMem post-v0.2 follow-up work
Summary
Remove the redundant range read in verified hydration:
memory.hydrate_memory_detailedreads the byte range (src/hotmem/memory.py:244), thenprovenance.verify_range(src/hotmem/provenance.py:103) re-reads the same range to hash it.Measured impact (spike #48, PR #84, B1)
Single-read hashing of the already-held bytes is ~1.16–1.65x faster than the current double-read path across range sizes (+16% at 100 MB). Both reads hit the page cache, so the cost is copy+syscalls, not I/O — still pure overhead.
Proposal
Hash the bytes already read in hydrate (or add a verify API that accepts in-memory bytes), keeping the same
ProvenanceErrorsemantics on mismatch.Acceptance criteria
bench/native_spike/results.jsonshow the improvement; no API/behavior change otherwise.Context
Spike recommendation follow-up #1:
bench/native_spike/README.md. Related: #48, #38, #40.