summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2018-05-24 21:31:03 -0700
committerGitHub <noreply@github.com>2018-05-24 21:31:03 -0700
commita777261d9c2bb275f97d87ceb01d50318221e42c (patch)
treedec8f47c19f9cab6435ffb1f88be29212d7fda89
parent055620ccd669ea56d83391e107a467824cd5b60b (diff)
parent1bcc8afc27653b4fb712df5d741ec78c11229bb0 (diff)
downloadnumpy-a777261d9c2bb275f97d87ceb01d50318221e42c.tar.gz
Merge pull request #11152 from lagru/pad-benchmarks
BENCH: Add basic benchmarks for numpy.pad
-rw-r--r--benchmarks/benchmarks/bench_lib.py25
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)