Skip to content

Commit

Permalink
Add benchmark script
Browse files Browse the repository at this point in the history
  • Loading branch information
avian2 committed Jun 12, 2014
1 parent cb76f36 commit ee1d251
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions benchmark.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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 L in xrange(5, 25, 5):
for c in cls:
methods.append("%s(L=%d)" % (c, L))

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%.1f" % (method, Ns, t)

main()

0 comments on commit ee1d251

Please sign in to comment.