diff options
author | Kevin Sheppard <kevin.k.sheppard@gmail.com> | 2018-05-10 11:12:20 +0100 |
---|---|---|
committer | Kevin Sheppard <kevin.k.sheppard@gmail.com> | 2018-05-10 12:21:36 +0100 |
commit | 4cb22829bcdd12da97455253a6aca6fd1053982d (patch) | |
tree | 0d27bd9404760de8d709fe4c4d5f3d2ee174fa6d /benchmarks | |
parent | 324b6df63d4b81cc430299c0ade5a750f1bc9f5f (diff) | |
download | numpy-4cb22829bcdd12da97455253a6aca6fd1053982d.tar.gz |
BENCH: Add benchmark for permutation
Add permutation benchmarks for 1d, 2d and scalar
Diffstat (limited to 'benchmarks')
-rw-r--r-- | benchmarks/benchmarks/bench_random.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/benchmarks/benchmarks/bench_random.py b/benchmarks/benchmarks/bench_random.py index 7ed3e2fa1..9d84d83d3 100644 --- a/benchmarks/benchmarks/bench_random.py +++ b/benchmarks/benchmarks/bench_random.py @@ -65,3 +65,18 @@ class Randint_dtype(Benchmark): high = self.high[name] np.random.randint(0, high + 1, size=10**5, dtype=name) + +class Permutation(Benchmark): + def setup(self): + self.n = 10000 + self.a_1d = np.random.random_sample(self.n) + self.a_2d = np.random.random_sample((self.n, 2)) + + def time_permutation_1d(self): + np.random.permutation(self.a_1d) + + def time_permutation_2d(self): + np.random.permutation(self.a_2d) + + def time_permutation_int(self): + np.random.permutation(self.n) |