Skip to content

Commit 98b0c10

Browse files
Merge pull request #609 from Blosc/blosc2-msgpack
Support for serializing diverse Blosc2 objects in msgpack
2 parents 185c67e + 0edae8b commit 98b0c10

18 files changed

+1447
-90
lines changed

bench/batch_store.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
NBATCHES = 10_000
2020
OBJECTS_PER_BATCH = 100
2121
TOTAL_OBJECTS = NBATCHES * OBJECTS_PER_BATCH
22-
BLOCKSIZE_MAX = 32
22+
ITEMS_PER_BLOCK = 32
2323
N_RANDOM_READS = 1_000
2424

2525

@@ -64,7 +64,7 @@ def build_store(
6464
storage = blosc2.Storage(mode="w")
6565
store = blosc2.BatchStore(
6666
storage=storage,
67-
max_blocksize=BLOCKSIZE_MAX,
67+
items_per_block=ITEMS_PER_BLOCK,
6868
serializer=serializer,
6969
cparams={
7070
"codec": codec,
@@ -84,7 +84,7 @@ def build_store(
8484
"use_dict": use_dict and codec in (blosc2.Codec.ZSTD, blosc2.Codec.LZ4, blosc2.Codec.LZ4HC),
8585
}
8686
with blosc2.BatchStore(
87-
storage=storage, max_blocksize=BLOCKSIZE_MAX, serializer=serializer, cparams=cparams
87+
storage=storage, items_per_block=ITEMS_PER_BLOCK, serializer=serializer, cparams=cparams
8888
) as store:
8989
for batch_index in range(NBATCHES):
9090
store.append(make_batch(batch_index))
@@ -132,7 +132,7 @@ def main() -> None:
132132
assert store is not None
133133
read_store = store
134134
else:
135-
read_store = blosc2.BatchStore(urlpath=URLPATH, mode="r", contiguous=True, max_blocksize=BLOCKSIZE_MAX)
135+
read_store = blosc2.BatchStore(urlpath=URLPATH, mode="r", contiguous=True, items_per_block=ITEMS_PER_BLOCK)
136136
samples, timings_ns = measure_random_reads(read_store)
137137
t0 = time.perf_counter()
138138
checksum = 0
@@ -147,7 +147,7 @@ def main() -> None:
147147
print(f" build time: {build_time_s:.3f} s")
148148
print(f" batches: {len(read_store)}")
149149
print(f" items: {TOTAL_OBJECTS}")
150-
print(f" max_blocksize: {read_store.max_blocksize}")
150+
print(f" items_per_block: {read_store.items_per_block}")
151151
print()
152152
print(read_store.info)
153153
print(f"Random scalar reads: {N_RANDOM_READS}")

0 commit comments

Comments
 (0)