summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2019-02-14 22:57:36 +0200
committerGitHub <noreply@github.com>2019-02-14 22:57:36 +0200
commit806a9453979d0435073a5b343adc16cdc29a9afb (patch)
tree2b863c9d33200ee2032da8c12d9fb81e6a4543a7 /benchmarks
parentffc044ad702ffb7a4991be1f0766a988259387a1 (diff)
parent7afb94aa056512be762b6b67e6b7f8da16532b17 (diff)
downloadnumpy-806a9453979d0435073a5b343adc16cdc29a9afb.tar.gz
Merge pull request #8159 from wrwrwr/import-benchmark
ENH: Add import time benchmarks.
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/benchmarks/bench_import.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/benchmarks/benchmarks/bench_import.py b/benchmarks/benchmarks/bench_import.py
new file mode 100644
index 000000000..83edecafe
--- /dev/null
+++ b/benchmarks/benchmarks/bench_import.py
@@ -0,0 +1,36 @@
+from __future__ import absolute_import, division, print_function
+
+from subprocess import call
+from sys import executable
+from timeit import default_timer
+
+from .common import Benchmark
+
+
+class Import(Benchmark):
+ timer = default_timer
+
+ def execute(self, command):
+ call((executable, '-c', command))
+
+ def time_numpy(self):
+ self.execute('import numpy')
+
+ def time_numpy_inspect(self):
+ # What are the savings from avoiding to import the inspect module?
+ self.execute('import numpy, inspect')
+
+ def time_fft(self):
+ self.execute('from numpy import fft')
+
+ def time_linalg(self):
+ self.execute('from numpy import linalg')
+
+ def time_ma(self):
+ self.execute('from numpy import ma')
+
+ def time_matlib(self):
+ self.execute('from numpy import matlib')
+
+ def time_random(self):
+ self.execute('from numpy import random')