File size: 1,175 Bytes
2c3c408 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | import shutil
import tempfile
import numpy as np
import tiledb
class Basic:
def setup(self, *shape):
self.path = tempfile.mkdtemp()
self.array = np.random.rand(4)
tiledb.from_numpy(self.path, self.array)
def time_open(self):
for i in range(5_000):
with tiledb.open(self.path):
pass
class DenseRead:
# parameterize over different array shapes
# the functions below will be called with permutations
# of these tuples
params = [
(100, 500),
(1000, 100000),
]
def setup(self, *shape):
self.path = tempfile.mkdtemp()
self.array = np.random.rand(*shape)
tiledb.from_numpy(self.path, self.array)
def time_read(self, *shape):
with tiledb.open(self.path) as A:
A[:]
def teardown(self, *shape):
shutil.rmtree(self.path)
class DenseWrite:
params = [
(100, 500),
(1000, 100000),
]
paths = []
def setup(self, *shape):
self.array = np.random.rand(*shape)
def time_write(self, *shape):
path = tempfile.mkdtemp()
tiledb.from_numpy(path, self.array)
|