Skip to content

Commit 761358e

Browse files
committed
revert line trace; add simple bench
1 parent c8ba8ae commit 761358e

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

bench/compress_normal.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import numpy as np
2+
import sys
3+
sys.path.insert(0, '..')
4+
import zarr
5+
import line_profiler
6+
import timeit
7+
from zarr import blosc
8+
9+
# setup
10+
a = np.random.normal(2000, 1000, size=200000000).astype('u2')
11+
z = zarr.empty_like(a, chunks=1000000, compression='blosc', compression_opts=dict(cname='lz4', clevel=5, shuffle=2))
12+
print(z)
13+
14+
print('*' * 79)
15+
16+
# time
17+
t = timeit.repeat('z[:] = a', repeat=10, number=1, globals=globals())
18+
print(t)
19+
print(min(t))
20+
print(z)
21+
22+
# profile
23+
profile = line_profiler.LineProfiler(blosc.compress)
24+
profile.run('z[:] = a')
25+
profile.print_stats()
26+
27+
print('*' * 79)
28+
29+
# time
30+
t = timeit.repeat('z[:]', repeat=10, number=1, globals=globals())
31+
print(t)
32+
print(min(t))
33+
34+
# profile
35+
profile = line_profiler.LineProfiler(blosc.decompress)
36+
profile.run('z[:]')
37+
profile.print_stats()

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def blosc_extension():
4545
include_dirs += [os.path.join('c-blosc', 'blosc')]
4646
include_dirs += glob('c-blosc/internal-complibs/*')
4747
define_macros += [('HAVE_LZ4', 1), ('HAVE_SNAPPY', 1), ('HAVE_ZLIB', 1)]
48-
define_macros += [('CYTHON_TRACE', '1')]
48+
# define_macros += [('CYTHON_TRACE', '1')]
4949
include_dirs.append(np.get_include())
5050

5151
# determine CPU support for SSE2 and AVX2

zarr/blosc.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# -*- coding: utf-8 -*-
22
# cython: embedsignature=True
3-
# cython: profile=True
4-
# cython: linetrace=True
5-
# cython: binding=True
3+
# cython: profile=False
4+
# cython: linetrace=False
5+
# cython: binding=False
66
from __future__ import absolute_import, print_function, division
77
import threading
88

0 commit comments

Comments
 (0)