Created
December 9, 2010 20:25
-
-
Save zookos/735278 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from pyutil import benchutil | |
def meas(N, cand): | |
for i in range(N): | |
r = cand == 'x'*32 | |
def meas_right(N): | |
return meas(N, 'x'*32) | |
def meas_wrong(N): | |
return meas(N, 'y'*32) | |
print "nanoseconds to == with the right query string: " | |
benchutil.rep_bench(meas_right, 10**3, MAXREPS=100, UNITS_PER_SECOND=10**9) | |
benchutil.print_bench_footer(UNITS_PER_SECOND=10**9) | |
print "nanoseconds to == with the wrong query string: " | |
benchutil.rep_bench(meas_wrong, 10**3, MAXREPS=100, UNITS_PER_SECOND=10**9) | |
benchutil.print_bench_footer(UNITS_PER_SECOND=10**9) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment