-
Notifications
You must be signed in to change notification settings - Fork 14
/
benchmark.py
43 lines (34 loc) · 915 Bytes
/
benchmark.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
35
36
37
38
39
40
41
42
43
import numpy
import timeit
def main():
#x = numpy.random.normal(scale=3.3e-5, size=25000)
#x = numpy.random.normal(scale=4.0e-5, size=25000)
#x = numpy.random.normal(scale=7.8e-5, size=100000)
methods = [ "EnergyDetector()" ]
cls = [ "CAVDetector",
"CFNDetector",
"MACDetector",
"MMEDetector",
"EMEDetector",
"AGMDetector",
"METDetector" ]
for c in cls:
for L in xrange(5, 25, 5):
methods.append("%s(L=%d)" % (c, L))
for scfNp in [64, 128]:
methods.append("SCFDetector(Np=%d, L=%d)" % (scfNp, scfNp/4))
for Ns in [25000, 50000, 100000]:
for method in methods:
tm = timeit.Timer(
setup="""
import numpy
import sensing.methods
x = numpy.random.normal(scale=3.3e-5, size=%d)
det = sensing.methods.%s
""" % (Ns, method),
stmt = "det(x)")
N = 100
r = tm.repeat(repeat=10, number=N)
t = min(r)/float(N)*1e6 # us/exc.
print "%s\t%d\t%f" % (method, Ns, t)
main()