Charles KWON OhJun
40935b6103
perf: CDX byte-level decode + leaf cache — SCAN 20x faster
Ported from rddfive/cdx_engine.c cdx_leaf_decode_all():
- Replaced bit-by-bit extractBits loop with byte-level shift/mask
- Read reqByte as little-endian integer, extract recNo/dup/trl via masks
- 10x+ faster than per-bit extraction
Leaf page decode cache:
- Tag.cachedLeafOff/cachedLeafKeys: avoid re-decoding same leaf page
- SkipNext/SkipPrev use getLeafKeys() with cache
- GoTop/Seek populate cache on first decode
CDX 50K benchmark (ext4):
┌──────────────┬──────────┬──────────┬──────────┐
│ CDX 50K │ Harbour │ Before │ After │
├──────────────┼──────────┼──────────┼──────────┤
│ SCAN 50K │ 6ms │ 276ms │ 14ms │ ← 20x faster
│ SCOPE 35K │ 4ms │ 238ms │ 20ms │ ← 12x faster
│ SEEK NAME │ 27ms │ 362ms │ 239ms │
│ SEEK ID │ 18ms │ 320ms │ 195ms │
└──────────────┴──────────┴──────────┴──────────┘
CDX cross-read: 18/18 PASS. All unit tests PASS.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>