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.
- {loaderx-2.3.5/loaderx.egg-info → loaderx-2.3.8}/PKG-INFO +132 -190
- {loaderx-2.3.5 → loaderx-2.3.8}/README.md +131 -189
- {loaderx-2.3.5 → loaderx-2.3.8}/loaderx/__init__.py +1 -1
- {loaderx-2.3.5 → loaderx-2.3.8}/loaderx/utils.py +13 -21
- {loaderx-2.3.5 → loaderx-2.3.8}/loaderx/zrecord.py +1 -20
- {loaderx-2.3.5 → loaderx-2.3.8/loaderx.egg-info}/PKG-INFO +132 -190
- {loaderx-2.3.5 → loaderx-2.3.8}/loaderx.egg-info/SOURCES.txt +1 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/scripts/_bench_common.py +55 -158
- {loaderx-2.3.5 → loaderx-2.3.8}/scripts/bench.py +5 -5
- {loaderx-2.3.5 → loaderx-2.3.8}/scripts/bench_dense.py +8 -5
- {loaderx-2.3.5 → loaderx-2.3.8}/scripts/bench_ragged.py +23 -111
- loaderx-2.3.8/scripts/prepare_vision.py +167 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/scripts/requirements-bench.txt +3 -1
- {loaderx-2.3.5 → loaderx-2.3.8}/scripts/test_loaderx.py +18 -24
- {loaderx-2.3.5 → loaderx-2.3.8}/src/record/engine.zig +6 -7
- {loaderx-2.3.5 → loaderx-2.3.8}/src/record/executor.zig +1 -1
- {loaderx-2.3.5 → loaderx-2.3.8}/LICENSE +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/MANIFEST.in +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/build.zig +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/build.zig.zon +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/loaderx/_lib.py +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/loaderx/_store.py +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/loaderx/converter.py +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/loaderx/dataloader.py +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/loaderx/zsampler.py +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/loaderx.egg-info/dependency_links.txt +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/loaderx.egg-info/requires.txt +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/loaderx.egg-info/top_level.txt +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/pyproject.toml +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/scripts/build_wheels.py +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/scripts/prepare_tokens.py +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/setup.cfg +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/setup.py +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/src/record/storage.zig +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/src/store.zig +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/src/zsampler.zig +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/src/zstd/c.zig +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/COPYING +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/LICENSE +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/allocations.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/bits.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/bitstream.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/compiler.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/cpu.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/debug.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/debug.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/entropy_common.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/error_private.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/error_private.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/fse.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/fse_decompress.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/huf.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/mem.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/pool.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/pool.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/portability_macros.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/threading.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/threading.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/xxhash.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/xxhash.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/zstd_common.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/zstd_deps.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/zstd_internal.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/common/zstd_trace.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/clevels.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/fse_compress.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/hist.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/hist.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/huf_compress.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_compress.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_compress_internal.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_compress_literals.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_compress_literals.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_compress_sequences.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_compress_sequences.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_compress_superblock.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_compress_superblock.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_cwksp.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_double_fast.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_double_fast.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_fast.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_fast.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_lazy.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_lazy.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_ldm.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_ldm.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_ldm_geartab.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_opt.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_opt.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_preSplit.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstd_preSplit.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstdmt_compress.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/compress/zstdmt_compress.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/decompress/huf_decompress.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/decompress/huf_decompress_amd64.S +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/decompress/zstd_ddict.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/decompress/zstd_ddict.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/decompress/zstd_decompress.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/decompress/zstd_decompress_block.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/decompress/zstd_decompress_block.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/decompress/zstd_decompress_internal.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/dictBuilder/cover.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/dictBuilder/cover.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/dictBuilder/divsufsort.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/dictBuilder/divsufsort.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/dictBuilder/fastcover.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/dictBuilder/zdict.c +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/zdict.h +0 -0
- {loaderx-2.3.5 → loaderx-2.3.8}/vendor/zstd/lib/zstd.h +0 -0
- {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.
|
|
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
|
|
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
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
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:
|
|
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
|
-
|
|
621
|
-
|
|
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
|
|
646
|
-
|
|
647
|
-
|
|
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 |
|
|
654
|
-
| zrecord-zstdict |
|
|
655
|
-
| zrecord-raw |
|
|
656
|
-
| npy-mmap-raw |
|
|
657
|
-
| hdf5-raw |
|
|
658
|
-
| hdf5-gzip |
|
|
659
|
-
| lmdb-raw |
|
|
660
|
-
| arrow-ipc-raw |
|
|
661
|
-
| arrow-ipc-zstd |
|
|
662
|
-
| parquet-raw |
|
|
663
|
-
| parquet-zstd |
|
|
664
|
-
| arrayrecord-raw |
|
|
665
|
-
| arrayrecord-zstd |
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
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
|
-
####
|
|
668
|
+
#### Native-Resolution Ragged
|
|
678
669
|
|
|
679
|
-
This workload contains 2,500
|
|
680
|
-
|
|
681
|
-
|
|
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 |
|
|
689
|
-
| zrecord-zstdict |
|
|
690
|
-
| zrecord-raw |
|
|
691
|
-
| hdf5-raw |
|
|
692
|
-
|
|
|
693
|
-
|
|
|
694
|
-
|
|
|
695
|
-
|
|
|
696
|
-
|
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
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 |
|
|
733
|
-
| zrecord-zstdict |
|
|
734
|
-
| zrecord-raw |
|
|
735
|
-
| npy-mmap-raw |
|
|
736
|
-
| lmdb-raw |
|
|
737
|
-
| arrow-ipc-raw |
|
|
738
|
-
| arrayrecord-raw |
|
|
739
|
-
| arrayrecord-zstd |
|
|
740
|
-
|
|
741
|
-
The contiguous NumPy baseline is strongest when the whole corpus is
|
|
742
|
-
typed matrix. Zrecord-raw reaches 3.
|
|
743
|
-
record semantics
|
|
744
|
-
|
|
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 |
|
|
757
|
-
| zrecord-zstdict |
|
|
758
|
-
| zrecord-raw |
|
|
759
|
-
| lmdb-raw |
|
|
760
|
-
| arrow-ipc-raw |
|
|
761
|
-
| arrayrecord-raw |
|
|
762
|
-
| arrayrecord-zstd |
|
|
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
|
|
766
|
-
|
|
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
|
|
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 |
|
|
813
|
-
| loaderx-raw | threads | zrecord-raw |
|
|
814
|
-
| torch | fork | npy-mmap-raw |
|
|
815
|
-
| torch-spawn | spawn | npy-mmap-raw |
|
|
816
|
-
| grain | processes | arrayrecord-zstd |
|
|
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.
|
|
824
|
-
Torch spawn and 3.
|
|
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 (
|
|
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 |
|
|
839
|
-
| 2 |
|
|
840
|
-
| 4 |
|
|
841
|
-
| 8 |
|
|
842
|
-
|
|
843
|
-
Spawn peak PSS grows from
|
|
844
|
-
while fork grows from
|
|
845
|
-
workers spawn uses 2.
|
|
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
|
|
856
|
-
|
|
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** |
|
|
862
|
-
| loaderx-raw |
|
|
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
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
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
|
|
893
|
-
|
|
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.
|
|
899
|
-
raw loaderx is
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
1130
|
-
|
|
1131
|
-
open and shared, lock-free, across all reader
|
|
1132
|
-
|
|
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
|
|