Last active
August 29, 2015 14:25
-
-
Save mdboom/5769234ab3f96054adc6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
from pyasdf import AsdfFile | |
import numpy as np | |
import time | |
for i in (10, 100, 1000, 10000): | |
arrays = [] | |
for x in range(i): | |
arrays.append(np.random.rand(32, 32)) | |
tree = {'arrays': arrays} | |
ff = AsdfFile(tree).write_to('test.asdf') | |
t = time.time() | |
with AsdfFile.open('test.asdf') as ff: | |
np.array(ff.tree['arrays'][i-1]) | |
t0 = time.time() - t | |
ff = AsdfFile(tree).write_to('test_noindex.asdf', include_block_index=False) | |
t = time.time() | |
with AsdfFile.open('test_noindex.asdf') as ff: | |
np.array(ff.tree['arrays'][i-1]) | |
t1 = time.time() - t | |
print("{0}: Indexed: {1}, Unindexed: {2}".format(i, t0, t1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment