Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
run: |
conda activate zarr-env
python -m pip install --upgrade pip
python -m pip install -U pip setuptools wheel codecov
python -m pip install -U pip setuptools wheel codecov line_profiler
python -m pip install -rrequirements_dev_minimal.txt numpy${{ matrix.numpy_version}} -rrequirements_dev_optional.txt pymongo redis
python -m pip install -e .
python -m pip freeze
Expand Down
52 changes: 28 additions & 24 deletions bench/compress_normal.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,38 @@
import zarr
from zarr import blosc

sys.path.insert(0, '..')
if __name__ == "__main__":

# setup
a = np.random.normal(2000, 1000, size=200000000).astype('u2')
z = zarr.empty_like(a, chunks=1000000, compression='blosc', compression_opts=dict(cname='lz4', clevel=5, shuffle=2))
print(z)
sys.path.insert(0, '..')

print('*' * 79)
# setup
a = np.random.normal(2000, 1000, size=200000000).astype('u2')
z = zarr.empty_like(a, chunks=1000000,
compression='blosc',
compression_opts=dict(cname='lz4', clevel=5, shuffle=2))
print(z)

# time
t = timeit.repeat('z[:] = a', repeat=10, number=1, globals=globals())
print(t)
print(min(t))
print(z)
print('*' * 79)

# profile
profile = line_profiler.LineProfiler(blosc.compress)
profile.run('z[:] = a')
profile.print_stats()
# time
t = timeit.repeat('z[:] = a', repeat=10, number=1, globals=globals())
print(t)
print(min(t))
print(z)

print('*' * 79)
# profile
profile = line_profiler.LineProfiler(blosc.compress)
profile.run('z[:] = a')
profile.print_stats()

# time
t = timeit.repeat('z[:]', repeat=10, number=1, globals=globals())
print(t)
print(min(t))
print('*' * 79)

# profile
profile = line_profiler.LineProfiler(blosc.decompress)
profile.run('z[:]')
profile.print_stats()
# time
t = timeit.repeat('z[:]', repeat=10, number=1, globals=globals())
print(t)
print(min(t))

# profile
profile = line_profiler.LineProfiler(blosc.decompress)
profile.run('z[:]')
profile.print_stats()
2 changes: 1 addition & 1 deletion requirements_dev_optional.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tox==3.23.1
coverage
flake8==3.9.2
pytest-cov==2.12.1
pytest-doctestplus==0.4.0
pytest-doctestplus==0.9.0
h5py==3.2.1
s3fs==2021.5.0
fsspec==2021.5.0
Expand Down