-
-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from alimanfoo/issue_55
blosc returns bytes; resolves #55
- Loading branch information
Showing
6 changed files
with
999 additions
and
609 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
200 changes: 200 additions & 0 deletions
200
notebooks/.ipynb_checkpoints/blosc_microbench-checkpoint.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"'2.0.1'" | ||
] | ||
}, | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import zarr\n", | ||
"zarr.__version__" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"10 loops, best of 3: 110 ms per loop\n", | ||
"1 loop, best of 3: 235 ms per loop\n", | ||
"Array((100000000,), int64, chunks=(200000,), order=C)\n", | ||
" nbytes: 762.9M; nbytes_stored: 11.2M; ratio: 67.8; initialized: 500/500\n", | ||
" compressor: Blosc(cname='lz4', clevel=5, shuffle=1)\n", | ||
" store: dict\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"z = zarr.empty(shape=100000000, chunks=200000, dtype='i8')\n", | ||
"data = np.arange(100000000, dtype='i8')\n", | ||
"%timeit z[:] = data\n", | ||
"%timeit z[:]\n", | ||
"print(z)\n", | ||
"assert np.all(z[:] == data)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"1 loop, best of 3: 331 ms per loop\n", | ||
"1 loop, best of 3: 246 ms per loop\n", | ||
"Array((100000000,), float64, chunks=(200000,), order=C)\n", | ||
" nbytes: 762.9M; nbytes_stored: 724.8M; ratio: 1.1; initialized: 500/500\n", | ||
" compressor: Blosc(cname='lz4', clevel=5, shuffle=1)\n", | ||
" store: dict\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"z = zarr.empty(shape=100000000, chunks=200000, dtype='f8')\n", | ||
"data = np.random.normal(size=100000000)\n", | ||
"%timeit z[:] = data\n", | ||
"%timeit z[:]\n", | ||
"print(z)\n", | ||
"assert np.all(z[:] == data)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"'2.0.2.dev0+dirty'" | ||
] | ||
}, | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import sys\n", | ||
"sys.path.insert(0, '..')\n", | ||
"import zarr\n", | ||
"zarr.__version__" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"10 loops, best of 3: 92.7 ms per loop\n", | ||
"1 loop, best of 3: 230 ms per loop\n", | ||
"Array((100000000,), int64, chunks=(200000,), order=C)\n", | ||
" nbytes: 762.9M; nbytes_stored: 11.2M; ratio: 67.8; initialized: 500/500\n", | ||
" compressor: Blosc(cname='lz4', clevel=5, shuffle=1)\n", | ||
" store: dict\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"z = zarr.empty(shape=100000000, chunks=200000, dtype='i8')\n", | ||
"data = np.arange(100000000, dtype='i8')\n", | ||
"%timeit z[:] = data\n", | ||
"%timeit z[:]\n", | ||
"print(z)\n", | ||
"assert np.all(z[:] == data)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"1 loop, best of 3: 338 ms per loop\n", | ||
"1 loop, best of 3: 253 ms per loop\n", | ||
"Array((100000000,), float64, chunks=(200000,), order=C)\n", | ||
" nbytes: 762.9M; nbytes_stored: 724.8M; ratio: 1.1; initialized: 500/500\n", | ||
" compressor: Blosc(cname='lz4', clevel=5, shuffle=1)\n", | ||
" store: dict\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"z = zarr.empty(shape=100000000, chunks=200000, dtype='f8')\n", | ||
"data = np.random.normal(size=100000000)\n", | ||
"%timeit z[:] = data\n", | ||
"%timeit z[:]\n", | ||
"print(z)\n", | ||
"assert np.all(z[:] == data)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.5.1" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 1 | ||
} |
Oops, something went wrong.