Skip to content

Commit

Permalink
BENCH: Add basic benchmarks for numpy.pad
Browse files Browse the repository at this point in the history
  • Loading branch information
lagru committed May 24, 2018
1 parent 4d02fb1 commit 1bcc8af
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions benchmarks/benchmarks/bench_lib.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 1bcc8af

Please sign in to comment.