forked from numpy/numpy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bench_import.py
34 lines (23 loc) · 838 Bytes
/
bench_import.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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')