File tree Expand file tree Collapse file tree 4 files changed +10
-6
lines changed Expand file tree Collapse file tree 4 files changed +10
-6
lines changed Original file line number Diff line number Diff line change
1
+ Improved performance of reading arrays by not unnecessarily using
2
+ the fill value.
Original file line number Diff line number Diff line change @@ -427,6 +427,11 @@ async def read(
427
427
The second slice selection determines where in the output array the chunk data will be written.
428
428
The ByteGetter is used to fetch the necessary bytes.
429
429
The chunk spec contains information about the construction of an array from the bytes.
430
+
431
+ If the Store returns ``None`` for a chunk, then the chunk was not
432
+ written and the implementation must set the values of that chunk (or
433
+ ``out``) to the fill value for the array.
434
+
430
435
out : NDBuffer
431
436
"""
432
437
...
Original file line number Diff line number Diff line change @@ -451,11 +451,10 @@ async def _decode_single(
451
451
)
452
452
453
453
# setup output array
454
- out = chunk_spec .prototype .nd_buffer .create (
454
+ out = chunk_spec .prototype .nd_buffer .empty (
455
455
shape = shard_shape ,
456
456
dtype = shard_spec .dtype .to_native_dtype (),
457
457
order = shard_spec .order ,
458
- fill_value = 0 ,
459
458
)
460
459
shard_dict = await _ShardReader .from_bytes (shard_bytes , self , chunks_per_shard )
461
460
@@ -498,11 +497,10 @@ async def _decode_partial_single(
498
497
)
499
498
500
499
# setup output array
501
- out = shard_spec .prototype .nd_buffer .create (
500
+ out = shard_spec .prototype .nd_buffer .empty (
502
501
shape = indexer .shape ,
503
502
dtype = shard_spec .dtype .to_native_dtype (),
504
503
order = shard_spec .order ,
505
- fill_value = 0 ,
506
504
)
507
505
508
506
indexed_chunks = list (indexer )
Original file line number Diff line number Diff line change @@ -1349,11 +1349,10 @@ async def _get_selection(
1349
1349
f"shape of out argument doesn't match. Expected { indexer .shape } , got { out .shape } "
1350
1350
)
1351
1351
else :
1352
- out_buffer = prototype .nd_buffer .create (
1352
+ out_buffer = prototype .nd_buffer .empty (
1353
1353
shape = indexer .shape ,
1354
1354
dtype = out_dtype ,
1355
1355
order = self .order ,
1356
- fill_value = self .metadata .fill_value ,
1357
1356
)
1358
1357
if product (indexer .shape ) > 0 :
1359
1358
# need to use the order from the metadata for v2
You can’t perform that action at this time.
0 commit comments