Skip to content

Instantly share code, notes, and snippets.

@bnlucas
Last active November 21, 2016 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bnlucas/7640e3651e4388e16d26656987e7c49e to your computer and use it in GitHub Desktop.
Save bnlucas/7640e3651e4388e16d26656987e7c49e to your computer and use it in GitHub Desktop.
--------------------------------------------------------------------------------
BaseHash vs Hashbrown
testing instantiation and hashing combined
base: 62
length: 171
value: 3154851373153015827738309232812515645550893040441169750950287100081801
7098580981494840912925603132017160147302934098705114421342560722423313
4700199050224309707192084206558324823774511143549765069844412467187455
4591569422379635281662772563764296566812258180788198965409784329587392
583208081351811265973977087
comparing best 10 of 10 loops.
--------------------------------------------------------------------------------
hashbrown_instantiate @ 0.249872613s
basehash_instantiate @ 0.250482416s
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
BaseHash vs Hashbrown
testing hashing
base: 62
length: 171
value: 3154851373153015827738309232812515645550893040441169750950287100081801
7098580981494840912925603132017160147302934098705114421342560722423313
4700199050224309707192084206558324823774511143549765069844412467187455
4591569422379635281662772563764296566812258180788198965409784329587392
583208081351811265973977087
comparing best 10 of 10 loops.
--------------------------------------------------------------------------------
hashbrown_hash @ 0.000086808s
basehash_hash @ 0.000100088s
--------------------------------------------------------------------------------
3500 function calls in 0.289 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.289 0.289 <string>:1(<module>)
1 0.000 0.000 0.289 0.289 __init__.py:105(__init__)
1 0.000 0.000 0.289 0.289 __init__.py:22(__init__)
1 0.000 0.000 0.000 0.000 __init__.py:33(encode)
1 0.000 0.000 0.000 0.000 __init__.py:54(hash)
355 0.001 0.000 0.001 0.000 fractions.py:18(gcd)
1 0.000 0.000 0.000 0.000 primes.py:119(selfridge)
1 0.011 0.011 0.011 0.011 primes.py:136(lucas_sequence)
93 0.000 0.000 0.269 0.003 primes.py:166(strong_pseudoprime)
1 0.000 0.000 0.012 0.012 primes.py:207(strong_lucas_pseudoprime)
141 0.003 0.000 0.287 0.002 primes.py:231(baillie_psw)
212 0.000 0.000 0.289 0.001 primes.py:254(is_prime)
1 0.000 0.000 0.289 0.289 primes.py:274(next_prime)
355 0.001 0.000 0.002 0.000 primes.py:37(gcd)
258 0.003 0.000 0.003 0.000 primes.py:43(isqrt)
141 0.000 0.000 0.002 0.000 primes.py:69(is_square)
94 0.000 0.000 0.000 0.000 primes.py:77(factor)
2 0.000 0.000 0.000 0.000 primes.py:91(jacobi)
1 0.000 0.000 0.289 0.289 test.py:64(basehash_instantiate)
355 0.000 0.000 0.000 0.000 {abs}
171 0.000 0.000 0.000 0.000 {divmod}
3 0.000 0.000 0.000 0.000 {len}
171 0.000 0.000 0.000 0.000 {method 'append' of 'list' objects}
399 0.000 0.000 0.000 0.000 {method 'bit_length' of 'long' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
1 0.000 0.000 0.000 0.000 {method 'join' of 'str' objects}
1 0.000 0.000 0.000 0.000 {method 'rjust' of 'str' objects}
117 0.000 0.000 0.000 0.000 {min}
265 0.269 0.001 0.269 0.001 {pow}
355 0.000 0.000 0.001 0.000 {reduce}
3330 function calls in 0.302 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.302 0.302 <string>:1(<module>)
1 0.000 0.000 0.302 0.302 __init__.py:29(hash62)
1 0.000 0.000 0.000 0.000 model.py:22(set_base)
1 0.000 0.000 0.000 0.000 model.py:34(encode)
1 0.000 0.000 0.000 0.000 model.py:57(hash)
1 0.000 0.000 0.302 0.302 model.py:9(__init__)
1 0.000 0.000 0.000 0.000 primes.py:121(selfridge)
1 0.010 0.010 0.010 0.010 primes.py:138(lucas_sequence)
1 0.000 0.000 0.000 0.000 primes.py:14(modinv)
93 0.000 0.000 0.284 0.003 primes.py:168(strong_pseudoprime)
1 0.000 0.000 0.010 0.010 primes.py:209(strong_lucas_pseudoprime)
141 0.003 0.000 0.300 0.002 primes.py:233(baillie_psw)
212 0.000 0.000 0.301 0.001 primes.py:256(is_prime)
1 0.000 0.000 0.302 0.302 primes.py:276(next_prime)
355 0.000 0.000 0.001 0.000 primes.py:35(gcd)
355 0.001 0.000 0.001 0.000 primes.py:36(_gcd)
258 0.003 0.000 0.003 0.000 primes.py:45(isqrt)
141 0.000 0.000 0.002 0.000 primes.py:71(is_square)
94 0.000 0.000 0.000 0.000 primes.py:79(factor)
2 0.000 0.000 0.000 0.000 primes.py:93(jacobi)
1 0.000 0.000 0.302 0.302 test.py:69(hashbrown_instantiate)
355 0.000 0.000 0.000 0.000 {abs}
171 0.000 0.000 0.000 0.000 {divmod}
3 0.000 0.000 0.000 0.000 {len}
399 0.000 0.000 0.000 0.000 {method 'bit_length' of 'long' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
1 0.000 0.000 0.000 0.000 {method 'rjust' of 'str' objects}
117 0.000 0.000 0.000 0.000 {min}
265 0.283 0.001 0.283 0.001 {pow}
355 0.000 0.000 0.001 0.000 {reduce}
test1 at 10000 iterations: 0.0708320140839
Can perform 141179 calls per second.
170006 function calls in 0.071 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.071 0.071 <string>:1(<module>)
10000 0.030 0.000 0.052 0.000 __init__.py:33(encode)
10000 0.012 0.000 0.065 0.000 __init__.py:54(hash)
1 0.003 0.003 0.071 0.071 test.py:13(func)
10000 0.003 0.000 0.068 0.000 test.py:86(test1)
60000 0.009 0.000 0.009 0.000 {divmod}
60000 0.006 0.000 0.006 0.000 {method 'append' of 'list' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
10000 0.007 0.000 0.007 0.000 {method 'join' of 'str' objects}
10000 0.002 0.000 0.002 0.000 {method 'rjust' of 'str' objects}
1 0.000 0.000 0.000 0.000 {range}
2 0.000 0.000 0.000 0.000 {time.time}
test2 at 10000 iterations: 0.0355820655823
Can perform 281040 calls per second.
40006 function calls in 0.036 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.036 0.036 <string>:1(<module>)
10000 0.020 0.000 0.020 0.000 model.py:33(encode)
10000 0.010 0.000 0.031 0.000 model.py:63(hash)
1 0.002 0.002 0.036 0.036 test.py:13(func)
10000 0.003 0.000 0.033 0.000 test.py:91(test2)
10000 0.001 0.000 0.001 0.000 {len}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
1 0.000 0.000 0.000 0.000 {range}
2 0.000 0.000 0.000 0.000 {time.time}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment