|
9 | 9 |
|
10 | 10 | if __name__ == "__main__": |
11 | 11 |
|
12 | | - sys.path.insert(0, '..') |
| 12 | + sys.path.insert(0, "..") |
13 | 13 |
|
14 | 14 | # setup |
15 | | - a = np.random.normal(2000, 1000, size=200000000).astype('u2') |
16 | | - z = zarr.empty_like(a, chunks=1000000, |
17 | | - compression='blosc', |
18 | | - compression_opts=dict(cname='lz4', clevel=5, shuffle=2)) |
| 15 | + a = np.random.normal(2000, 1000, size=200000000).astype("u2") |
| 16 | + z = zarr.empty_like( |
| 17 | + a, |
| 18 | + chunks=1000000, |
| 19 | + compression="blosc", |
| 20 | + compression_opts=dict(cname="lz4", clevel=5, shuffle=2), |
| 21 | + ) |
19 | 22 | print(z) |
20 | 23 |
|
21 | | - print('*' * 79) |
| 24 | + print("*" * 79) |
22 | 25 |
|
23 | 26 | # time |
24 | | - t = timeit.repeat('z[:] = a', repeat=10, number=1, globals=globals()) |
| 27 | + t = timeit.repeat("z[:] = a", repeat=10, number=1, globals=globals()) |
25 | 28 | print(t) |
26 | 29 | print(min(t)) |
27 | 30 | print(z) |
28 | 31 |
|
29 | 32 | # profile |
30 | 33 | profile = line_profiler.LineProfiler(blosc.compress) |
31 | | - profile.run('z[:] = a') |
| 34 | + profile.run("z[:] = a") |
32 | 35 | profile.print_stats() |
33 | 36 |
|
34 | | - print('*' * 79) |
| 37 | + print("*" * 79) |
35 | 38 |
|
36 | 39 | # time |
37 | | - t = timeit.repeat('z[:]', repeat=10, number=1, globals=globals()) |
| 40 | + t = timeit.repeat("z[:]", repeat=10, number=1, globals=globals()) |
38 | 41 | print(t) |
39 | 42 | print(min(t)) |
40 | 43 |
|
41 | 44 | # profile |
42 | 45 | profile = line_profiler.LineProfiler(blosc.decompress) |
43 | | - profile.run('z[:]') |
| 46 | + profile.run("z[:]") |
44 | 47 | profile.print_stats() |
0 commit comments