Download testbed/TileDB-Inc__TileDB-Py/tiledb/tests/perf/benchmarks/array.py from hc99/FEA-Bench: direct link, hf CLI and curl.
- Browser
- Download file 1.18 kB
-
https://huggingface.co/datasets/hc99/FEA-Bench/resolve/main/testbed/TileDB-Inc__TileDB-Py/tiledb/tests/perf/benchmarks/array.py
- Command line
-
hf download hf://datasets/hc99/FEA-Bench/testbed/TileDB-Inc__TileDB-Py/tiledb/tests/perf/benchmarks/array.py
-
curl -L -o array.py https://huggingface.co/datasets/hc99/FEA-Bench/resolve/main/testbed/TileDB-Inc__TileDB-Py/tiledb/tests/perf/benchmarks/array.py
1.18 kB
| 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) | |