Record mmap bulk copy discoveries
ober
a00ba7377703ede19f3df6957fd5d1bdc629f568
--- a/data/anti-patterns.sexp +++ b/data/anti-patterns.sexp @@ -4380,4 +4380,23 @@ ("title" . "Do Not Trust Capacity Results While Stale Workers Run") - ("tools" "ps" "pgrep" "time" "benchmark"))) + ("tools" "ps" "pgrep" "time" "benchmark")) + (("advice" + . + "Validate the range once, copy bounded chunks with a native bulk primitive, hash them with (std crypto native), and regression-check the persisted format against the pure digest implementation.") + ("avoid" + . + "Do not copy or hash an entire large mapping with one mmap-u8-ref call per byte; FFI and bounds-check overhead can dominate startup by orders of magnitude.") + ("id" . "scalar-mmap-access-for-whole-file-digest") + ("kinds" "module") + ("pattern" . "mmap-u8-ref.*(sha|digest|checksum)") + ("severity" . "medium") + ("tags" "mmap" "checksum" "sha256" "performance" "native") + ("title" + . + "Do Not Hash Large Mappings Through Scalar Accessors") + ("tools" + "jerboa_howto" + "jerboa_verify" + "benchmark" + "jerboa_security_scan"))) --- a/data/features.sexp +++ b/data/features.sexp @@ -3640,4 +3640,21 @@ ("use_case" . "Long capacity and soak benchmarks that may survive an interrupted agent session and contaminate later measurements.") + ("votes" . 0)) + (("description" + . + "Provide mmap-copy-out! and a bounded mmap-range->bytevector implemented with one native memcpy after range validation. The current mmap->bytevector and custom input-port callbacks copy through per-byte foreign-ref loops.") + ("estimated_token_reduction" + . + "~300 tokens and one local FFI helper per mmap consumer") + ("example_scenario" + . + "A 258 MB QIX checksum took tens of seconds through scalar mmap-u8-ref calls; bounded native copies into Jerboa's existing native SHA reduced full validation to 140 ms.") + ("id" . "std-mmap-bulk-copy-out") ("impact" . "high") + ("status" . "proposed") + ("tags" "mmap" "memcpy" "bytevector" "performance") + ("title" . "Add native bulk copy-out to std mmap") + ("use_case" + . + "Checksums, parsers, and codecs that consume bounded chunks from large mappings through existing bytevector APIs.") ("votes" . 0)))