loaderx 2.3.5__tar.gz → 2.3.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. {loaderx-2.3.5/loaderx.egg-info → loaderx-2.3.8}/PKG-INFO +132 -190
  2. {loaderx-2.3.5 → loaderx-2.3.8}/README.md +131 -189
  3. {loaderx-2.3.5 → loaderx-2.3.8}/loaderx/__init__.py +1 -1
  4. {loaderx-2.3.5 → loaderx-2.3.8}/loaderx/utils.py +13 -21
  5. {loaderx-2.3.5 → loaderx-2.3.8}/loaderx/zrecord.py +1 -20
  6. {loaderx-2.3.5 → loaderx-2.3.8/loaderx.egg-info}/PKG-INFO +132 -190
  7. {loaderx-2.3.5 → loaderx-2.3.8}/loaderx.egg-info/SOURCES.txt +1 -0
  8. {loaderx-2.3.5 → loaderx-2.3.8}/scripts/_bench_common.py +55 -158
  9. {loaderx-2.3.5 → loaderx-2.3.8}/scripts/bench.py +5 -5
  10. {loaderx-2.3.5 → loaderx-2.3.8}/scripts/bench_dense.py +8 -5
  11. {loaderx-2.3.5 → loaderx-2.3.8}/scripts/bench_ragged.py +23 -111
  12. loaderx-2.3.8/scripts/prepare_vision.py +167 -0
  13. {loaderx-2.3.5 → loaderx-2.3.8}/scripts/requirements-bench.txt +3 -1
  14. {loaderx-2.3.5 → loaderx-2.3.8}/scripts/test_loaderx.py +18 -24
  15. {loaderx-2.3.5 → loaderx-2.3.8}/src/record/engine.zig +6 -7
  16. {loaderx-2.3.5 → loaderx-2.3.8}/src/record/executor.zig +1 -1
  17. {loaderx-2.3.5 → loaderx-2.3.8}/LICENSE +0 -0
  18. {loaderx-2.3.5 → loaderx-2.3.8}/MANIFEST.in +0 -0
  19. {loaderx-2.3.5 → loaderx-2.3.8}/build.zig +0 -0
  20. {loaderx-2.3.5 → loaderx-2.3.8}/build.zig.zon +0 -0
  21. {loaderx-2.3.5 → loaderx-2.3.8}/loaderx/_lib.py +0 -0
  22. {loaderx-2.3.5 → loaderx-2.3.8}/loaderx/_store.py +0 -0
  23. {loaderx-2.3.5 → loaderx-2.3.8}/loaderx/converter.py +0 -0
  24. {loaderx-2.3.5 → loaderx-2.3.8}/loaderx/dataloader.py +0 -0
  25. {loaderx-2.3.5 → loaderx-2.3.8}/loaderx/zsampler.py +0 -0
  26. {loaderx-2.3.5 → loaderx-2.3.8}/loaderx.egg-info/dependency_links.txt +0 -0
  27. {loaderx-2.3.5 → loaderx-2.3.8}/loaderx.egg-info/requires.txt +0 -0
  28. {loaderx-2.3.5 → loaderx-2.3.8}/loaderx.egg-info/top_level.txt +0 -0
  29. {loaderx-2.3.5 → loaderx-2.3.8}/pyproject.toml +0 -0
  30. {loaderx-2.3.5 → loaderx-2.3.8}/scripts/build_wheels.py +0 -0
  31. {loaderx-2.3.5 → loaderx-2.3.8}/scripts/prepare_tokens.py +0 -0
  32. {loaderx-2.3.5 → loaderx-2.3.8}/setup.cfg +0 -0
  33. {loaderx-2.3.5 → loaderx-2.3.8}/setup.py +0 -0
  34. {loaderx-2.3.5 → loaderx-2.3.8}/src/record/storage.zig +0 -0
  35. {loaderx-2.3.5 → loaderx-2.3.8}/src/store.zig +0 -0
  36. {loaderx-2.3.5 → loaderx-2.3.8}/src/zsampler.zig +0 -0
  37. {loaderx-2.3.5 → loaderx-2.3.8}/src/zstd/c.zig +0 -0
  38. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/COPYING +0 -0
  39. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/LICENSE +0 -0
  40. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/allocations.h +0 -0
  41. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/bits.h +0 -0
  42. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/bitstream.h +0 -0
  43. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/compiler.h +0 -0
  44. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/cpu.h +0 -0
  45. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/debug.c +0 -0
  46. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/debug.h +0 -0
  47. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/entropy_common.c +0 -0
  48. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/error_private.c +0 -0
  49. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/error_private.h +0 -0
  50. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/fse.h +0 -0
  51. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/fse_decompress.c +0 -0
  52. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/huf.h +0 -0
  53. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/mem.h +0 -0
  54. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/pool.c +0 -0
  55. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/pool.h +0 -0
  56. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/portability_macros.h +0 -0
  57. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/threading.c +0 -0
  58. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/threading.h +0 -0
  59. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/xxhash.c +0 -0
  60. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/xxhash.h +0 -0
  61. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/zstd_common.c +0 -0
  62. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/zstd_deps.h +0 -0
  63. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/zstd_internal.h +0 -0
  64. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/zstd_trace.h +0 -0
  65. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/clevels.h +0 -0
  66. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/fse_compress.c +0 -0
  67. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/hist.c +0 -0
  68. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/hist.h +0 -0
  69. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/huf_compress.c +0 -0
  70. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_compress.c +0 -0
  71. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_compress_internal.h +0 -0
  72. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_compress_literals.c +0 -0
  73. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_compress_literals.h +0 -0
  74. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_compress_sequences.c +0 -0
  75. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_compress_sequences.h +0 -0
  76. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_compress_superblock.c +0 -0
  77. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_compress_superblock.h +0 -0
  78. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_cwksp.h +0 -0
  79. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_double_fast.c +0 -0
  80. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_double_fast.h +0 -0
  81. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_fast.c +0 -0
  82. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_fast.h +0 -0
  83. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_lazy.c +0 -0
  84. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_lazy.h +0 -0
  85. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_ldm.c +0 -0
  86. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_ldm.h +0 -0
  87. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_ldm_geartab.h +0 -0
  88. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_opt.c +0 -0
  89. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_opt.h +0 -0
  90. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_preSplit.c +0 -0
  91. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_preSplit.h +0 -0
  92. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstdmt_compress.c +0 -0
  93. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstdmt_compress.h +0 -0
  94. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/decompress/huf_decompress.c +0 -0
  95. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/decompress/huf_decompress_amd64.S +0 -0
  96. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/decompress/zstd_ddict.c +0 -0
  97. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/decompress/zstd_ddict.h +0 -0
  98. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/decompress/zstd_decompress.c +0 -0
  99. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/decompress/zstd_decompress_block.c +0 -0
  100. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/decompress/zstd_decompress_block.h +0 -0
  101. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/decompress/zstd_decompress_internal.h +0 -0
  102. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/dictBuilder/cover.c +0 -0
  103. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/dictBuilder/cover.h +0 -0
  104. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/dictBuilder/divsufsort.c +0 -0
  105. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/dictBuilder/divsufsort.h +0 -0
  106. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/dictBuilder/fastcover.c +0 -0
  107. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/dictBuilder/zdict.c +0 -0
  108. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/zdict.h +0 -0
  109. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/zstd.h +0 -0
  110. {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/zstd_errors.h +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: loaderx
3
- Version: 2.3.5
3
+ Version: 2.3.8
4
4
  Summary: Rebuildable high-performance ordered record containers
5
5
  Author-email: Ben0i0d <ben0i0d@foxmail.com>
6
6
  License-Expression: MIT
@@ -380,29 +380,16 @@ published without one.
380
380
  for general-purpose compression; it is fast and must be selected explicitly.
381
381
 
382
382
  `"zstd_dict"` trains a shared dictionary on a sample of the data before writing
383
- any record, then compresses every record against it at level 15. The dictionary
383
+ any record, then compresses every record against it at level 3. The dictionary
384
384
  captures structure shared across records that per-record compression cannot see —
385
- a large win for many small, similar records (image tiles, token sequences).
386
-
387
- The dictionary's cost is a cache footprint: every record's decompression
388
- references the shared dictionary window, so a larger dictionary means more
389
- cache misses on gather — the path a loader pays forever. Three named tiers
390
- (`loaderx.zrecord.DICT_TIERS`) preset the whole tradeoff — the dictionary size
391
- and how much data trains it — so a caller picks a tier, never a number:
392
-
393
- | tier | dict | sample | tradeoff |
394
- |------|------|--------|----------|
395
- | `"fast"` | 32 KiB | 4 MiB | fastest gather and training; ratio barely above `zstd` |
396
- | `"balanced"` | 128 KiB | 16 MiB | **default** — most of the ratio at a fraction of the gather cost |
397
- | `"max"` | 1 MiB | 64 MiB | best ratio; slowest gather and training |
398
-
399
- The sample is the byte budget the dictionary trains on (a strided subset of the
400
- records), so each tier costs the same training time whatever the record size.
401
- At realistic image scale (768 KiB records) the tiers converge — on the earlier
402
- measurement box's structured data `"balanced"` and `"max"` both gather
403
- ~1.6 GiB/s at a 1.74x ratio — because a dictionary is a small fraction of a
404
- large frame. The tiers still matter at small record sizes, where the dict is
405
- most of a record and `"max"` trades gather throughput for ratio.
385
+ a useful fit for large corpora of small, similar records such as token sequences
386
+ and image tiles. Plain `"zstd"` or `"raw"` remains the better default for large
387
+ records and small corpora.
388
+
389
+ Dictionary geometry is fixed: `train_dict` trains a dictionary of at most 32 KiB
390
+ from a strided sample bounded at 4 MiB. Real WikiText and MNIST profiling found
391
+ that larger 128 KiB and 1 MiB dictionaries added training and cache cost without
392
+ a stable ratio or gather advantage. There is no dictionary tuning API.
406
393
 
407
394
  `"zstd_dict"` records can only be read from a store that has the dictionary
408
395
  (`dict.zr`). The dictionary is loaded on open and shared, lock-free, across all
@@ -410,7 +397,7 @@ reader threads.
410
397
 
411
398
  A dictionary must train on the settled, complete data. :func:`train_dict` is the
412
399
  standalone, **manual** training step — a numpy array, an iterable of records, or
413
- a typed container all train the same way, sized by a tier — and its bytes are handed to
400
+ a typed container all train the same fixed contract — and its bytes are handed to
414
401
  a container-writing path via ``dict_bytes``. ``zstd_dict`` never trains by itself: a
415
402
  write without a dictionary is an error. A stream cannot train its own
416
403
  dictionary, but it can write with one trained on the settled data:
@@ -420,7 +407,7 @@ from loaderx.utils import train_dict
420
407
  from loaderx.zrecord import Dense, Ragged
421
408
 
422
409
  # train once on the settled data — a standalone, reusable artifact
423
- d = train_dict(settled_array, tier="balanced")
410
+ d = train_dict(settled_array)
424
411
 
425
412
  # then any new store can install it and append explicitly
426
413
  with Ragged.create('tokens', np.int32, ndim=1,
@@ -555,7 +542,8 @@ caller's to own and reuse. This is the entire H2D answer — there is no `pin=`
555
542
  hook or device backend, because the only unified thing a multi-framework loader
556
543
  can own is the CPU batch.
557
544
 
558
- For practical integration examples, please refer to the **[Data2Latent](https://codeberg.org/eoelab/Data2Latent)** repository
545
+ For a practical JAX/Flax integration, see the
546
+ **[MNIST layer-representation example](examples/mnist_latent/)**.
559
547
 
560
548
  ## Benchmarks
561
549
 
@@ -568,12 +556,12 @@ so CFFI, NumPy allocation, and Ragged list/shape reconstruction are timed.
568
556
 
569
557
  ### Methodology
570
558
 
571
- The comparison matrix began as one complete run on a warm page cache. All
572
- Zrecord Store rows and the two loaderx identity rows were refreshed on 2.3.0
573
- with the default `data_shards=4`. Unchanged
574
- optional Store backends, sampler rows and external loader rows remain from the
575
- immediately preceding 2.0.9 run. These are not three-run medians: an unexpected result is traced
576
- separately instead of being hidden by repeated aggregation. Within each store workload every
559
+ The comparison matrix began as one complete run on a warm page cache. Most Store
560
+ matrices and the loader rows were refreshed on 2.3.6 with the default
561
+ `data_shards=4`; the Dense token matrix was refreshed on 2.3.8 after the append
562
+ window increased to 32,768 records. Every workload uses a prepared real source.
563
+ These are not three-run medians: an unexpected result is traced separately
564
+ instead of being hidden by repeated aggregation. Within each store workload every
577
565
  backend receives identical source records. Correctness and timing use independent
578
566
  deterministic `zsampler` IID streams. Loader backends receive
579
567
  the same source and seed but use their own shipped samplers, so their exact
@@ -592,7 +580,7 @@ operation. Reusable source preparation is outside that timer; in particular,
592
580
  The measured Store paths are explicit:
593
581
 
594
582
  ```text
595
- write: make_data returns -> writer setup [untimed]
583
+ write: source is ready -> writer setup [untimed]
596
584
  -> start -> encode/pack -> append/write -> logical finalize -> return -> stop
597
585
  -> resource-only cleanup [untimed]
598
586
 
@@ -617,8 +605,10 @@ reconstruction are included, while open, close and destruction after return are
617
605
  not.
618
606
  Every backend name states its actual codec; the full default set is required
619
607
  rather than silently skipped when a package is missing.
620
- Dense and Ragged use the same CHW RGB image generator, record count, batch plan
621
- and seed. Dense fixes every image at `(3, 224, 224)`; Ragged changes only H and W.
608
+ The vision source is the Oxford-IIIT Pet train split prepared by
609
+ `scripts/prepare_vision.py`. Dense uses RGB photographs resized on the short side
610
+ to 256 and center-cropped to `(3, 224, 224)`; Ragged uses the same ordered source
611
+ at native RGB resolution. Both are mmap-loaded uint8 CHW records.
622
612
 
623
613
  **Machine** — one local workstation (AMD Ryzen AI 9 HX PRO 370, 12 cores / 24
624
614
  threads):
@@ -642,75 +632,67 @@ pipeline. Store reads run on the ordinary page cache.
642
632
 
643
633
  #### Fixed-Shape Dense
644
634
 
645
- Zrecord against array-store alternatives: random batch gather, 2,500 CHW RGB
646
- records, batch 256. Every image is `(3, 224, 224)` and comes from the same
647
- spatial model used by the variable-shape benchmark.
635
+ Zrecord against array-store alternatives: random batch gather over the first
636
+ 2,500 Oxford-IIIT Pet train images, batch 256. Every prepared image is
637
+ `uint8[3,224,224]`; `metadata.json` records the source revision, transform,
638
+ decoder versions and logical SHA-256.
648
639
 
649
640
  Fixed-resolution vision records — 147 KiB per record, 36.8 MiB per batch:
650
641
 
651
642
  | backend | logical write | logical gather | krecords/s | p95 | disk | ratio |
652
643
  |---|---:|---:|---:|---:|---:|---:|
653
- | zrecord-zstd | 7172 MiB/s | 11081 MiB/s | 77.2 | 4.38 ms | 24.4 MiB | 14.69x |
654
- | zrecord-zstdict | 104 MiB/s | 12042 MiB/s | 83.9 | 4.09 ms | 16.2 MiB | 22.10x |
655
- | zrecord-raw | 5721 MiB/s | 14457 MiB/s | 100.7 | 3.16 ms | 358.9 MiB | 1.00x |
656
- | npy-mmap-raw | 2004 MiB/s | 4749 MiB/s | 33.1 | 11.08 ms | 358.9 MiB | 1.00x |
657
- | hdf5-raw | 2350 MiB/s | 1836 MiB/s | 12.8 | 29.68 ms | 359.0 MiB | 1.00x |
658
- | hdf5-gzip | 277 MiB/s | 657 MiB/s | 4.6 | 62.53 ms | 26.1 MiB | 13.73x |
659
- | lmdb-raw | 1546 MiB/s | 4034 MiB/s | 28.1 | 11.38 ms | 361.4 MiB | 0.99x |
660
- | arrow-ipc-raw | 1766 MiB/s | 3413 MiB/s | 23.8 | 15.10 ms | 358.9 MiB | 1.00x |
661
- | arrow-ipc-zstd | 656 MiB/s | 174 MiB/s | 1.2 | 239.23 ms | 22.6 MiB | 15.86x |
662
- | parquet-raw | 1174 MiB/s | 435 MiB/s | 3.0 | 95.45 ms | 358.9 MiB | 1.00x |
663
- | parquet-zstd | 592 MiB/s | 159 MiB/s | 1.1 | 251.37 ms | 22.6 MiB | 15.86x |
664
- | arrayrecord-raw | 1704 MiB/s | 2066 MiB/s | 14.4 | 20.36 ms | 359.2 MiB | 1.00x |
665
- | arrayrecord-zstd | 804 MiB/s | 1294 MiB/s | 9.0 | 36.89 ms | 25.1 MiB | 14.32x |
666
- | tiledb-raw | 743 MiB/s | 630 MiB/s | 4.4 | 66.01 ms | 359.0 MiB | 1.00x |
667
- | tiledb-zstd | 1498 MiB/s | 1503 MiB/s | 10.5 | 27.82 ms | 26.9 MiB | 13.36x |
668
-
669
- At 147 KiB per record, Zrecord-raw reaches 14.1 GiB/s and is 3.0x npy-mmap-raw;
670
- plain zstd gathers at 10.8 GiB/s while reducing the corpus 14.69x. LMDB and Arrow
644
+ | zrecord-zstd | 1375 MiB/s | 6020 MiB/s | 41.9 | 6.97 ms | 311.1 MiB | 1.15x |
645
+ | zrecord-zstdict | 1145 MiB/s | 7318 MiB/s | 51.0 | 6.06 ms | 320.1 MiB | 1.12x |
646
+ | zrecord-raw | 5111 MiB/s | 14808 MiB/s | 103.2 | 2.81 ms | 358.9 MiB | 1.00x |
647
+ | npy-mmap-raw | 2023 MiB/s | 4751 MiB/s | 33.1 | 10.46 ms | 358.9 MiB | 1.00x |
648
+ | hdf5-raw | 2310 MiB/s | 1903 MiB/s | 13.3 | 22.33 ms | 359.0 MiB | 1.00x |
649
+ | hdf5-gzip | 41 MiB/s | 213 MiB/s | 1.5 | 193.93 ms | 301.8 MiB | 1.19x |
650
+ | lmdb-raw | 1359 MiB/s | 4120 MiB/s | 28.7 | 10.10 ms | 361.4 MiB | 0.99x |
651
+ | arrow-ipc-raw | 1117 MiB/s | 3439 MiB/s | 24.0 | 12.89 ms | 358.9 MiB | 1.00x |
652
+ | arrow-ipc-zstd | 223 MiB/s | 97 MiB/s | 0.7 | 399.21 ms | 305.9 MiB | 1.17x |
653
+ | parquet-raw | 1237 MiB/s | 454 MiB/s | 3.2 | 85.72 ms | 358.9 MiB | 1.00x |
654
+ | parquet-zstd | 215 MiB/s | 80 MiB/s | 0.6 | 480.45 ms | 305.9 MiB | 1.17x |
655
+ | arrayrecord-raw | 1852 MiB/s | 2092 MiB/s | 14.6 | 20.84 ms | 359.2 MiB | 1.00x |
656
+ | arrayrecord-zstd | 219 MiB/s | 1779 MiB/s | 12.4 | 23.15 ms | 320.1 MiB | 1.12x |
657
+
658
+ At 147 KiB per record, Zrecord-raw reaches 14.5 GiB/s and is 3.1x npy-mmap-raw.
659
+ Decoded photographs have little remaining redundancy: plain zstd reduces them
660
+ only 1.15x, while dictionary mode falls to 1.12x. This is
661
+ why large real images should use plain zstd or raw. LMDB and Arrow
671
662
  IPC are competitive raw record
672
663
  stores, while codecs tied to whole IPC batches or Parquet row groups pay read
673
664
  amplification on random gathers. Dense demonstrates that
674
665
  typed record ownership and per-record compression do not turn fixed tensors
675
666
  into an object-store slow path.
676
667
 
677
- #### Variable-Shape Ragged
668
+ #### Native-Resolution Ragged
678
669
 
679
- This workload contains 2,500 variable-resolution CHW RGB images. Height and
680
- width are independently lognormal and clipped to 64..512 (observed medians
681
- 223 and 224), totaling 417.1 MiB of logical uint8 payload. Each of 50 random
670
+ This workload contains the first 2,500 native-resolution Oxford-IIIT Pet CHW RGB
671
+ images. Height is 108..2606 (median 375) and width is 117..3264 (median 500),
672
+ totaling 1252.3 MiB of logical uint8 payload. Each of 50 random
682
673
  batches contains 256 records. Every backend persists payload plus exact shape
683
674
  and must return an ordered `list[np.ndarray]` of `(3, H, W)` arrays; a flat byte
684
675
  list or a one-dimensional variable-length abstraction is not enough.
685
676
 
686
677
  | backend | logical write | logical gather | krecords/s | p95 | disk | ratio |
687
678
  |---|---:|---:|---:|---:|---:|---:|
688
- | zrecord-zstd | 2220 MiB/s | 9444 MiB/s | 56.7 | 5.67 ms | 26.9 MiB | 15.48x |
689
- | zrecord-zstdict | 102 MiB/s | 10345 MiB/s | 62.1 | 5.15 ms | 18.2 MiB | 22.97x |
690
- | zrecord-raw | 2171 MiB/s | 12356 MiB/s | 74.2 | 4.22 ms | 417.2 MiB | 1.00x |
691
- | hdf5-raw | 1451 MiB/s | 1059 MiB/s | 6.4 | 44.91 ms | 418.0 MiB | 1.00x |
692
- | hdf5-gzip | 250 MiB/s | 126 MiB/s | 0.7 | 359.23 ms | 29.9 MiB | 13.94x |
693
- | lmdb-raw | 1717 MiB/s | 7269 MiB/s | 43.6 | 7.93 ms | 422.2 MiB | 0.99x |
694
- | arrow-ipc-raw | 1363 MiB/s | 4015 MiB/s | 24.1 | 14.97 ms | 417.2 MiB | 1.00x |
695
- | arrow-ipc-zstd | 570 MiB/s | 198 MiB/s | 1.2 | 238.70 ms | 25.9 MiB | 16.10x |
696
- | parquet-raw | 927 MiB/s | 501 MiB/s | 3.0 | 94.62 ms | 417.2 MiB | 1.00x |
697
- | parquet-zstd | 507 MiB/s | 173 MiB/s | 1.0 | 268.56 ms | 25.9 MiB | 16.10x |
698
- | arrayrecord-raw | 1650 MiB/s | 2661 MiB/s | 16.0 | 18.19 ms | 417.6 MiB | 1.00x |
699
- | arrayrecord-zstd | 758 MiB/s | 1499 MiB/s | 9.0 | 39.16 ms | 27.2 MiB | 15.31x |
700
- | tiledb-raw | 392 MiB/s | 48 MiB/s | 0.3 | 941.09 ms | 417.2 MiB | 1.00x |
701
- | tiledb-zstd | 675 MiB/s | 138 MiB/s | 0.8 | 328.05 ms | 27.0 MiB | 15.46x |
702
-
703
- Zrecord-raw is 1.7x LMDB and 3.1x Arrow IPC in logical gather. Zrecord-zstd
704
- delivers 9.2 GiB/s of
705
- logical payload while reducing the corpus to 26.9 MiB. HDF5, Arrow IPC, Parquet,
706
- ArrayRecord and TileDB
707
- show the same framework/codec tradeoffs in both tables; compressed batch, chunk
708
- and row-group formats pay read amplification on random records.
709
-
710
- The shared generator makes compression ratios directly comparable across
711
- contracts: Zrecord zstd is 14.69x Dense versus 15.48x Ragged, and zstdict is
712
- 22.10x versus 22.97x. The remaining difference comes from the H/W distribution
713
- and Ragged shape metadata, not a different image entropy model.
679
+ | zrecord-zstd | 852 MiB/s | 4546 MiB/s | 9.1 | 49.35 ms | 1032.2 MiB | 1.21x |
680
+ | zrecord-zstdict | 705 MiB/s | 4493 MiB/s | 8.9 | 49.94 ms | 1032.9 MiB | 1.21x |
681
+ | zrecord-raw | 2080 MiB/s | 13367 MiB/s | 26.7 | 13.74 ms | 1252.4 MiB | 1.00x |
682
+ | hdf5-raw | 1909 MiB/s | 2302 MiB/s | 4.6 | 69.05 ms | 1253.1 MiB | 1.00x |
683
+ | lmdb-raw | 1818 MiB/s | 8758 MiB/s | 17.5 | 23.61 ms | 1257.0 MiB | 1.00x |
684
+ | arrow-ipc-raw | 1346 MiB/s | 4567 MiB/s | 9.1 | 41.32 ms | 1252.4 MiB | 1.00x |
685
+ | parquet-raw | 722 MiB/s | 513 MiB/s | 1.0 | 283.13 ms | 1252.4 MiB | 1.00x |
686
+ | arrayrecord-raw | 1644 MiB/s | 2753 MiB/s | 5.5 | 64.37 ms | 1253.0 MiB | 1.00x |
687
+ | arrayrecord-zstd | 188 MiB/s | 2008 MiB/s | 4.0 | 95.29 ms | 1054.6 MiB | 1.19x |
688
+
689
+ Zrecord-raw is 1.5x LMDB and 2.9x Arrow IPC in logical gather. Plain and
690
+ dictionary zstd both reach 1.21x, confirming that dictionary mode is not useful
691
+ for these large photographs. The Ragged matrix is intentionally asymmetric:
692
+ HDF5 gzip, Arrow IPC zstd and Parquet zstd adapters are not implemented because
693
+ the real 256-record batch took 1.1–1.7 seconds; TileDB variable queries took
694
+ 8.6–9.6 seconds and the backend was removed entirely. ArrayRecord zstd remains
695
+ because its batch p95 is 95 ms.
714
696
 
715
697
  ### Small Token Records
716
698
 
@@ -729,19 +711,20 @@ accumulate at least two seconds.
729
711
 
730
712
  | backend | logical write | logical gather | krecords/s | p95 | disk | ratio |
731
713
  |---|---:|---:|---:|---:|---:|---:|
732
- | zrecord-zstd | 989 MiB/s | 2012 MiB/s | 1030.3 | 0.34 ms | 193.2 MiB | 2.02x |
733
- | zrecord-zstdict | 62 MiB/s | 2079 MiB/s | 1064.6 | 0.32 ms | 154.4 MiB | 2.53x |
734
- | zrecord-raw | 4542 MiB/s | 6391 MiB/s | 3272.3 | 0.11 ms | 393.7 MiB | 0.99x |
735
- | npy-mmap-raw | 1587 MiB/s | 9070 MiB/s | 4644.0 | 0.08 ms | 390.6 MiB | 1.00x |
736
- | lmdb-raw | 639 MiB/s | 1104 MiB/s | 565.0 | 0.71 ms | 786.3 MiB | 0.50x |
737
- | arrow-ipc-raw | 2068 MiB/s | 225 MiB/s | 115.0 | 2.81 ms | 390.8 MiB | 1.00x |
738
- | arrayrecord-raw | 807 MiB/s | 150 MiB/s | 76.7 | 4.99 ms | 401.4 MiB | 0.97x |
739
- | arrayrecord-zstd | 127 MiB/s | 135 MiB/s | 69.4 | 4.45 ms | 201.3 MiB | 1.94x |
740
-
741
- The contiguous NumPy baseline is strongest when the whole corpus is one fixed
742
- typed matrix. Zrecord-raw reaches 3.27 Mrecords/s while retaining independent
743
- record semantics; the per-record zstd codecs halve disk and still return
744
- 1.03–1.06 Mrecords/s. LMDB's B-tree/page overhead is visible in both throughput
714
+ | zrecord-zstd | 1060 MiB/s | 2149 MiB/s | 1100.2 | 0.33 ms | 193.2 MiB | 2.02x |
715
+ | zrecord-zstdict | 1435 MiB/s | 2478 MiB/s | 1268.7 | 0.28 ms | 168.5 MiB | 2.32x |
716
+ | zrecord-raw | 5535 MiB/s | 7056 MiB/s | 3612.5 | 0.10 ms | 393.7 MiB | 0.99x |
717
+ | npy-mmap-raw | 1771 MiB/s | 10306 MiB/s | 5276.6 | 0.07 ms | 390.6 MiB | 1.00x |
718
+ | lmdb-raw | 692 MiB/s | 1133 MiB/s | 580.3 | 0.61 ms | 786.3 MiB | 0.50x |
719
+ | arrow-ipc-raw | 1330 MiB/s | 213 MiB/s | 109.2 | 4.09 ms | 390.8 MiB | 1.00x |
720
+ | arrayrecord-raw | 887 MiB/s | 158 MiB/s | 80.8 | 5.16 ms | 401.4 MiB | 0.97x |
721
+ | arrayrecord-zstd | 123 MiB/s | 134 MiB/s | 68.5 | 4.69 ms | 201.3 MiB | 1.94x |
722
+
723
+ The contiguous NumPy baseline is strongest for gather when the whole corpus is
724
+ one fixed typed matrix. Zrecord-raw reaches 3.61 Mrecords/s while retaining
725
+ independent record semantics and writes 3.1x faster than npy-mmap-raw;
726
+ dictionary zstd writes 35% faster than plain zstd, uses 13% less disk and gathers
727
+ 15% faster in this pass. LMDB's B-tree/page overhead is visible in both throughput
745
728
  and disk.
746
729
 
747
730
  #### Variable Token Sequences
@@ -753,18 +736,18 @@ with exact `int32` values and original one-dimensional shapes.
753
736
 
754
737
  | backend | logical write | logical gather | krecords/s | p95 | disk | ratio |
755
738
  |---|---:|---:|---:|---:|---:|---:|
756
- | zrecord-zstd | 287 MiB/s | 315 MiB/s | 594.6 | 0.60 ms | 67.4 MiB | 1.57x |
757
- | zrecord-zstdict | 54 MiB/s | 332 MiB/s | 627.6 | 0.58 ms | 49.1 MiB | 2.16x |
758
- | zrecord-raw | 536 MiB/s | 389 MiB/s | 734.9 | 0.50 ms | 110.5 MiB | 0.96x |
759
- | lmdb-raw | 318 MiB/s | 113 MiB/s | 214.3 | 1.48 ms | 153.0 MiB | 0.69x |
760
- | arrow-ipc-raw | 562 MiB/s | 44 MiB/s | 83.1 | 4.00 ms | 109.9 MiB | 0.96x |
761
- | arrayrecord-raw | 288 MiB/s | 26 MiB/s | 49.3 | 7.39 ms | 118.8 MiB | 0.89x |
762
- | arrayrecord-zstd | 62 MiB/s | 33 MiB/s | 61.5 | 5.58 ms | 76.2 MiB | 1.39x |
739
+ | zrecord-zstd | 268 MiB/s | 337 MiB/s | 637.3 | 0.52 ms | 67.4 MiB | 1.57x |
740
+ | zrecord-zstdict | 368 MiB/s | 367 MiB/s | 692.8 | 0.49 ms | 53.0 MiB | 2.00x |
741
+ | zrecord-raw | 682 MiB/s | 434 MiB/s | 819.1 | 0.41 ms | 110.5 MiB | 0.96x |
742
+ | lmdb-raw | 316 MiB/s | 108 MiB/s | 204.2 | 1.53 ms | 151.8 MiB | 0.70x |
743
+ | arrow-ipc-raw | 317 MiB/s | 42 MiB/s | 80.3 | 4.65 ms | 109.1 MiB | 0.97x |
744
+ | arrayrecord-raw | 291 MiB/s | 28 MiB/s | 52.7 | 7.63 ms | 118.0 MiB | 0.90x |
745
+ | arrayrecord-zstd | 59 MiB/s | 29 MiB/s | 55.2 | 5.71 ms | 76.0 MiB | 1.39x |
763
746
 
764
747
  Here the record contract, not bulk byte bandwidth, is the useful scale.
765
- Zrecord's three codecs return 595–735 krecords/s with 0.50–0.60 ms p95;
766
- the dictionary gives the best disk ratio and is slightly ahead of plain zstd in
767
- this pass.
748
+ Zrecord's three codecs return 637–819 krecords/s with 0.41–0.52 ms p95.
749
+ Dictionary zstd writes 37% faster than plain zstd, uses 21% less disk and gathers
750
+ 9% faster in this pass.
768
751
 
769
752
  ### Sampler
770
753
 
@@ -785,7 +768,7 @@ a 1.87–7.96x margin across batch sizes.
785
768
 
786
769
  The full input pipeline comparison (sample, fetch, collate, hand over a batch)
787
770
  uses exactly the Dense vision source above: 2,500 `(3,224,224)` uint8
788
- records from `make_vision_records`, 4 high-level workers, and batch 256
771
+ Oxford-IIIT Pet records from the prepared mmap corpus, 4 high-level workers, and batch 256
789
772
  (36.8 MiB). After warmup, throughput and memory are collected during one
790
773
  200-batch qualitative pass. `peak PSS` sums proportional
791
774
  set size across the process tree, apportioning mapped shared and copy-on-write
@@ -809,19 +792,19 @@ and Grain reads ArrayRecord.
809
792
 
810
793
  | loader | model | storage | batches/s | p95 | steady PSS | peak PSS | peak RSS |
811
794
  |---|---|---|---:|---:|---:|---:|---:|
812
- | **loaderx** | threads | zrecord-zstd | 171.5 | 12.69 ms | 984 MiB | 985 MiB | 988 MiB |
813
- | loaderx-raw | threads | zrecord-raw | 200.0 | 12.50 ms | 993 MiB | 993 MiB | 996 MiB |
814
- | torch | fork | npy-mmap-raw | 109.4 | 32.70 ms | 1783 MiB | 1889 MiB | 6396 MiB |
815
- | torch-spawn | spawn | npy-mmap-raw | 111.6 | 30.69 ms | 2835 MiB | 2913 MiB | 4880 MiB |
816
- | grain | processes | arrayrecord-zstd | 46.6 | 93.48 ms | 1847 MiB | 1946 MiB | 2065 MiB |
795
+ | **loaderx** | threads | zrecord-zstd | 129.2 | 10.68 ms | 641 MiB | 666 MiB | 670 MiB |
796
+ | loaderx-raw | threads | zrecord-raw | 226.7 | 7.97 ms | 668 MiB | 669 MiB | 672 MiB |
797
+ | torch | fork | npy-mmap-raw | 91.7 | 40.30 ms | 1403 MiB | 1597 MiB | 3845 MiB |
798
+ | torch-spawn | spawn | npy-mmap-raw | 115.2 | 30.41 ms | 2632 MiB | 2710 MiB | 4700 MiB |
799
+ | grain | processes | arrayrecord-zstd | 43.0 | 101.51 ms | 1706 MiB | 1770 MiB | 1892 MiB |
817
800
 
818
801
  At 36.8 MiB per batch the per-batch gather dominates the tiny sampler cost, and
819
802
  the transform threads overlap Python-side collation with the next gather. The
820
803
  memory is the source, Zrecord container and bounded in-flight batches. loaderx prefetches in
821
804
  threads inside one process, so workers share one interpreter, one NumPy runtime
822
805
  and one set of gather buffers. With source geometry and entropy held constant,
823
- raw is 1.17x compressed loaderx; compressed loaderx is 1.57x Torch fork, 1.54x
824
- Torch spawn and 3.68x Grain, while raw is 1.83x, 1.79x and 4.29x faster.
806
+ raw is 1.75x compressed loaderx; compressed loaderx is 1.41x Torch fork, 1.12x
807
+ Torch spawn and 3.00x Grain, while raw is 2.47x, 1.97x and 5.27x faster.
825
808
  Torch's aggregate RSS is high because
826
809
  Linux fork mappings are counted repeatedly; it is not a total-memory ratio
827
810
  against Zrecord's unaccounted page cache. The explicit `torch-spawn` row removes
@@ -830,19 +813,19 @@ not copy the full corpus into every worker; a Windows Dataset holding Python
830
813
  lists or in-memory arrays would be a different, deliberately harsher workload.
831
814
 
832
815
  The Torch-only worker sweep runs each count once. Worker 0 is an in-process
833
- baseline (154.5 and 163.5 batches/s with 1484/1486 MiB peak PSS in the two equivalent
816
+ baseline (74.8 and 79.8 batches/s with 1413/1415 MiB peak PSS in the two equivalent
834
817
  rows), so the process-context comparison starts at one worker:
835
818
 
836
819
  | workers | fork batches/s | fork peak PSS | fork peak RSS | spawn batches/s | spawn peak PSS | spawn peak RSS |
837
820
  |---:|---:|---:|---:|---:|---:|---:|
838
- | 1 | 42.5 | 1647 MiB | 2483 MiB | 46.3 | 1890 MiB | 2128 MiB |
839
- | 2 | 68.9 | 1725 MiB | 3796 MiB | 72.3 | 2241 MiB | 3066 MiB |
840
- | 4 | 106.0 | 1849 MiB | 6385 MiB | 102.7 | 2878 MiB | 4859 MiB |
841
- | 8 | 114.3 | 2021 MiB | 11334 MiB | 107.8 | 4195 MiB | 8402 MiB |
842
-
843
- Spawn peak PSS grows from 1890 to 4195 MiB as workers rise from one to eight,
844
- while fork grows from 1647 to 2021 MiB because it retains COW sharing. At eight
845
- workers spawn uses 2.08x fork's peak PSS and throughput has already flattened.
821
+ | 1 | 49.3 | 1428 MiB | 1733 MiB | 46.8 | 1711 MiB | 1950 MiB |
822
+ | 2 | 78.2 | 1512 MiB | 2481 MiB | 79.0 | 2068 MiB | 2893 MiB |
823
+ | 4 | 111.5 | 1614 MiB | 3898 MiB | 113.1 | 2729 MiB | 4710 MiB |
824
+ | 8 | 123.2 | 1802 MiB | 6579 MiB | 124.2 | 4039 MiB | 8189 MiB |
825
+
826
+ Spawn peak PSS grows from 1711 to 4039 MiB as workers rise from one to eight,
827
+ while fork grows from 1428 to 1802 MiB because it retains COW sharing. At eight
828
+ workers spawn uses 2.24x fork's peak PSS and throughput has already flattened.
846
829
  This demonstrates no-fork memory pressure; it is not labeled OOM because this
847
830
  31 GiB machine completed the run. Fork aggregate RSS grows faster because Linux
848
831
  counts shared/COW mappings in every process, so RSS is diagnostic rather than
@@ -851,20 +834,19 @@ physical memory.
851
834
  **CPU-heavy transform solutions.** The same Python per-sample transform exposes
852
835
  the GIL bottleneck on standard CPython. Numba is an explicit solution, not the
853
836
  default: `--transform numba-nogil` compiles the equivalent batch transform with
854
- `nogil=True`. The other explicit solution runs the Python transform on
855
- free-threaded CPython. Numba compilation is warmed before timing. Store
856
- microbenchmarks are not repeated under free-threaded Python because Loaderx has
857
- no separate no-GIL Store implementation; the Store table above applies to both.
837
+ `nogil=True`. The other explicit solution runs the unchanged Python transform on
838
+ free-threaded CPython. Numba compilation is warmed before timing; both
839
+ interpreters use NumPy 2.4.6 and the same prepared real corpus.
858
840
 
859
841
  | loader | GIL Python | GIL + Numba nogil | free-threaded Python | Numba gain | free-threaded gain |
860
842
  |---|---:|---:|---:|---:|---:|
861
- | **loaderx** | 48.8 batches/s | 107.2 batches/s | 88.0 batches/s | **2.20x** | **1.80x** |
862
- | loaderx-raw | 51.2 batches/s | 113.1 batches/s | 94.1 batches/s | **2.21x** | **1.84x** |
843
+ | **loaderx** | 50.2 batches/s | 101.5 batches/s | 86.2 batches/s | **2.02x** | **1.72x** |
844
+ | loaderx-raw | 57.7 batches/s | 130.8 batches/s | 98.4 batches/s | **2.27x** | **1.71x** |
863
845
 
864
- Peak PSS for compressed/raw was 1193/1202 MiB with GIL Python,
865
- 1291/1314 MiB with Numba, and 1190/1191 MiB with free-threaded Python. These are
866
- two deployment solutions to the transform bottleneck, not claims that Store
867
- itself was optimized for either runtime.
846
+ Peak PSS for compressed/raw was 878/883 MiB with GIL Python, 942/967 MiB with
847
+ Numba, and 872/900 MiB with free-threaded Python. These are two deployment
848
+ solutions to the transform bottleneck, not claims that Store itself was
849
+ optimized for either runtime.
868
850
 
869
851
  **Conclusion** — why the numbers look like this.
870
852
 
@@ -889,14 +871,15 @@ specialization for compression and a complete variable-shape persistence model.
889
871
  "storage plus a codec": the layout, the multi-core decompress and the GIL-free
890
872
  copy are one path, so turning compression on costs part of a margin, not an
891
873
  order of magnitude. The ratio is the data, not the
892
- format: in the current Dense structured-vision workload, plain zstd reaches
893
- 14.69x and the balanced dictionary reaches 22.10x.
874
+ format: in the current real-photograph Dense workload, plain zstd reaches only
875
+ 1.15x and the fixed dictionary reaches 1.12x. Dictionary mode is for repeated
876
+ small records, not a universal higher-ratio setting.
894
877
 
895
878
  **Loader results combine architecture and storage.** loaderx uses threads and
896
879
  never ends an epoch, so a step pays no IPC and never waits on an epoch boundary;
897
880
  torch uses finite shuffled epochs, worker processes and shared-memory handoff.
898
- Here compressed loaderx is 1.57x Torch fork, 1.54x Torch spawn and 3.68x Grain;
899
- raw loaderx is 1.83x, 1.79x and 4.29x faster, respectively.
881
+ Here compressed loaderx is 1.41x Torch fork, 1.12x Torch spawn and 3.00x Grain;
882
+ raw loaderx is 2.47x, 1.97x and 5.27x faster, respectively.
900
883
  Storage also differs per loader — each reads from what it was
901
884
  built for — so the loader table is a different comparison from either store
902
885
  table, not a rerun.
@@ -915,55 +898,18 @@ views into one batch allocation, while most byte-store adapters return
915
898
  independent copies. This is a single benchmark run, while each Store read path
916
899
  accumulates at least two timed seconds —
917
900
  the µs-scale sampler timings and the loader `batches/s` fluctuate with box load
918
- (on these 12 cores the compressed loader trails the raw one by about 22%), so
901
+ (on these 12 cores the compressed loader trails the raw one materially), so
919
902
  treat the absolute numbers as ballpark and the cross-backend margins as the
920
903
  signal.
921
904
 
922
- ### Reproduction
923
-
924
- ```bash
925
- .venv/bin/python scripts/bench_dense.py
926
- .venv/bin/python scripts/bench_ragged.py
927
-
928
- .venv/bin/python scripts/prepare_tokens.py wiki.train.tokens /tmp/wikitext-gpt2
929
- .venv/bin/python scripts/bench_dense.py --workload tokens \
930
- --token-corpus /tmp/wikitext-gpt2 --records 200000 --batches 100
931
- .venv/bin/python scripts/bench_ragged.py --workload tokens \
932
- --token-corpus /tmp/wikitext-gpt2 --records 200000 --batches 100
933
-
934
- .venv/bin/python scripts/bench.py sampler
935
- .venv/bin/python scripts/bench.py loader \
936
- --only loaderx,loaderx-raw,torch,torch-spawn,grain --workers 4
937
- .venv/bin/python scripts/bench.py loader --only torch,torch-spawn \
938
- --workers 0,1,2,4,8
939
- .venv/bin/python scripts/bench.py loader \
940
- --only loaderx,loaderx-raw --workers 4 --transform python-loop
941
- .venv/bin/python scripts/bench.py loader --only loaderx,loaderx-raw \
942
- --workers 4 --transform numba-nogil
943
-
944
- .venv-t/bin/python scripts/bench.py loader --only loaderx,loaderx-raw \
945
- --workers 4 --transform python-loop
946
- ```
947
-
948
- `prepare_tokens.py` also accepts Hugging Face WikiText Parquet shards directly.
949
- The published run used `Salesforce/wikitext`, config `wikitext-103-raw-v1`,
950
- revision `refs/convert/parquet`, train shards `0000.parquet` then
951
- `0001.parquet`; their SHA-256 values are respectively
952
- `74da360f23826045b3e6ac6375411fdb15f003030aa74f2596ed08b857cb9212` and
953
- `ba090ac30dbf5461e8dcbdd1a1b8e6f3cf9c2c756d64f0c1220450acd514f720`.
954
- The focused token defaults omit formats that are already represented in the
955
- larger vision matrix; `--only` can select any registered backend explicitly.
956
- The loader rows used Numba 0.67.0, Torch 2.13.0 and Grain 0.2.18; all benchmark dependencies
957
- are pinned in `scripts/requirements-bench.txt`. Temporary stores used the ordinary
958
- disk-backed `/tmp` filesystem, not `/dev/shm`.
959
-
960
905
  ## Real-data verification
961
906
 
962
- Dataset-specific preprocessing and verification remain in the
907
+ Production dataset-specific preprocessing and verification remain in the
963
908
  **[DataPipe](https://codeberg.org/eoelab/DataPipe)** repository. The built-in
964
909
  converter covers standardized Hugging Face datasets; DataPipe handles sources
965
910
  without a common remote protocol and implements derived modalities as loader
966
- transforms without NumPy dump intermediates.
911
+ transforms without NumPy dump intermediates. Oxford-IIIT Pet is only the shared
912
+ benchmark fixture.
967
913
 
968
914
  ## Current Limitations
969
915
  * Single-host only; multi-host training is not supported.
@@ -981,10 +927,6 @@ transforms without NumPy dump intermediates.
981
927
  zig build # host shared objects, into loaderx/lib/
982
928
  zig build test # native store suite, in both Debug and ReleaseFast
983
929
  python3 scripts/test_loaderx.py # Python integration suite against the real build
984
- uv pip install --python .venv/bin/python -r scripts/requirements-bench.txt
985
- .venv/bin/python scripts/bench_dense.py # fixed-shape store comparison
986
- .venv/bin/python scripts/bench_ragged.py # variable-length store comparison
987
- .venv/bin/python scripts/bench.py # machine, sampler, and dense loader layers
988
930
  ```
989
931
 
990
932
  The Zig side is tested for behaviour only; throughput is measured from Python,
@@ -1107,7 +1049,7 @@ defend against bypassing the public Python API do not belong in zrecord.
1107
1049
  |-------|-----------|----------------------------------------|
1108
1050
  | 0 | raw | none |
1109
1051
  | 1 | zstd | zstd (plain, level 3) |
1110
- | 2 | zstdict | zstd with a trained dictionary (level 15) |
1052
+ | 2 | zstdict | zstd with a trained dictionary (level 3) |
1111
1053
  ```
1112
1054
 
1113
1055
  7. Compression is transparent to the client:
@@ -1126,10 +1068,10 @@ defend against bypassing the public Python API do not belong in zrecord.
1126
1068
  record is still independent, random access is unchanged — but the
1127
1069
  dictionary carries the structure shared across records, which per-record
1128
1070
  compression cannot see. On many small, similar records (image tiles, token
1129
- sequences) this is a large win: the current Dense structured-vision set
1130
- is 14.69x with plain zstd and 22.10x with the balanced dictionary. The dictionary is loaded once on
1131
- open and shared, lock-free, across all reader threads. The dictionary size
1132
- is chosen from the `DICT_TIERS` presets (see Codec notes).
1071
+ sequences) this can be a large win. Decoded real photographs are a useful
1072
+ counterexample where plain zstd or raw is the better fit. The 32 KiB
1073
+ dictionary is loaded once on open and shared, lock-free, across all reader
1074
+ threads.
1133
1075
  * A `zstd_dict` store needs its dictionary to read every record; a `raw` or
1134
1076
  `zstd` store rejects an unexpected dictionary as malformed state.
1135
1077