Streamline Format Version 7 In Segment Code

by Jule 44 views
Streamline Format Version 7 In Segment Code

The segment reader/writer now lives in version 7, but the codebase still carries old branches from v2 to v6 - dead logic that bloats the hot path and muddies clarity. The real problem? Seven separate decoders, scanners, and dispatch rules that fragment logic and drain test cycles. Every conditional if format_version >= N adds overhead without adding value - v7’s features are fully present, so legacy paths are just clutter. This isn’t just messy code; it’s a performance and audit nightmare. We’re removing redundant functions: linear_scan_block and decode_entry_header_ref, leaving only linear_scan_block_v4 and decode_entry_header_ref_v4. The bloom filter stays tight - only one magic magic number (0xFB) guards blocked formats. The only real elephant in the room? Teams still testing on older versions, patching headers, missing consistency. To keep v7 clean, reject all versions under 7, purge all version-switch branches, and simplify block_data_end into one seamless flow. This isn’t just cleanup - it’s reclaiming clarity. With dead code gone, read paths shrink, tests sharpen, and performance inches forward. Is your codebase still loaded with ghosts of old versions? It’s time to start fresh - v7 should be lean, not layered.