diff options
author | Lars G <lagru@mailbox.org> | 2018-05-23 22:08:00 +0200 |
---|---|---|
committer | Lars G <lagru@mailbox.org> | 2018-05-24 08:25:31 +0200 |
commit | 1bcc8afc27653b4fb712df5d741ec78c11229bb0 (patch) | |
tree | 150d3b431afc91a88f476c0f791b6be6ac714180 | |
parent | 4d02fb11352a45b05e5d50db6e71153b2aec7527 (diff) | |
download | numpy-1bcc8afc27653b4fb712df5d741ec78c11229bb0.tar.gz |
BENCH: Add basic benchmarks for numpy.pad
-rw-r--r-- | benchmarks/benchmarks/bench_lib.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/benchmarks/benchmarks/bench_lib.py b/benchmarks/benchmarks/bench_lib.py new file mode 100644 index 000000000..83f26c9d1 --- /dev/null +++ b/benchmarks/benchmarks/bench_lib.py @@ -0,0 +1,25 @@ +"""Benchmarks for `numpy.lib`.""" + + +from __future__ import absolute_import, division, print_function + +from .common import Benchmark + +import numpy as np + + +class Pad(Benchmark): + """Benchmarks for `numpy.pad`.""" + + param_names = ["shape", "pad_width", "mode"] + params = [ + [(1000,), (10, 100), (10, 10, 10)], + [1, 3, (0, 5)], + ["constant", "edge", "linear_ramp", "mean", "reflect", "wrap"], + ] + + def setup(self, shape, pad_width, mode): + self.array = np.empty(shape) + + def time_pad(self, shape, pad_width, mode): + np.pad(self.array, pad_width, mode) |