diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2020-06-16 16:05:36 -0500 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2020-06-16 16:05:36 -0500 |
commit | 16ab9b62e2eae4b90707554d7e9d376f5404cc8a (patch) | |
tree | 366e03853bba8e2084cad5bd76a224e48e814cce | |
parent | ea7f5ebbda0016438dc1b80c98ea3de8dfec7ca9 (diff) | |
download | numpy-16ab9b62e2eae4b90707554d7e9d376f5404cc8a.tar.gz |
BENCH: Expand array-creation tests
This adds some simple additional tests, one for a list of NumPy
scalars. Another for generally lists, both integers and floats
as one common cases (floats previously had some super-fast paths).
As well as a test with the dtype given, since that may make
some differences.
-rw-r--r-- | benchmarks/benchmarks/bench_core.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/benchmarks/benchmarks/bench_core.py b/benchmarks/benchmarks/bench_core.py index 060d0f7db..0c2a18c15 100644 --- a/benchmarks/benchmarks/bench_core.py +++ b/benchmarks/benchmarks/bench_core.py @@ -7,9 +7,13 @@ class Core(Benchmark): def setup(self): self.l100 = range(100) self.l50 = range(50) + self.float_l1000 = [float(i) for i in range(1000)] + self.float64_l1000 = [np.float64(i) for i in range(1000)] + self.int_l1000 = list(range(1000)) self.l = [np.arange(1000), np.arange(1000)] self.l_view = [memoryview(a) for a in self.l] self.l10x10 = np.ones((10, 10)) + self.float64_dtype = np.dtype(np.float64) def time_array_1(self): np.array(1) @@ -23,6 +27,18 @@ class Core(Benchmark): def time_array_l100(self): np.array(self.l100) + def time_array_float_l1000(self): + np.array(self.float_l1000) + + def time_array_float_l1000_dtype(self): + np.array(self.float_l1000, dtype=self.float64_dtype) + + def time_array_float64_l1000(self): + np.array(self.float64_l1000) + + def time_array_int_l1000(self): + np.array(self.int_l1000) + def time_array_l(self): np.array(self.l) |