<s> import time , os <EOL> try : <EOL> from jitpy import setup <EOL> import numba <EOL> CPYTHON = True <EOL> except : <EOL> CPYTHON = False <EOL> else : <EOL> setup ( os . environ [ '<STR_LIT>' ] ) <EOL> from jitpy . wrapper import jittify <EOL> NUMBER = <NUM_LIT> <EOL> def f ( a , b , c ) : <EOL> return <NUM_LIT:1> <EOL> def f2 ( a , b , c ) : <EOL> s = <NUM_LIT:0> <EOL> for i in xrange ( a ) : <EOL> s += a <EOL> s += b <EOL> s += c <EOL> return s <EOL> def check_py ( f ) : <EOL> for i in xrange ( NUMBER ) : <EOL> f ( <NUM_LIT:10> , i , i ) <EOL> def check_jitpy ( f ) : <EOL> jit_f = jittify ( [ int , int , int ] , int ) ( f ) <EOL> for i in xrange ( NUMBER ) : <EOL> jit_f ( <NUM_LIT:10> , i , i ) <EOL> def check_numba ( f ) : <EOL> jit_f = numba . jit ( f ) <EOL> for i in xrange ( NUMBER ) : <EOL> jit_f ( <NUM_LIT:10> , i , i ) <EOL> if CPYTHON : <EOL> ALL = [ ( '<STR_LIT>' , check_py ) , ( '<STR_LIT>' , check_jitpy ) , ( '<STR_LIT>' , check_numba ) ] <EOL> else : <EOL> ALL = [ ( '<STR_LIT>' , check_py ) ] <EOL> for bench_name , bench_func in [ ( '<STR_LIT>' , f ) , ( '<STR_LIT>' , f2 ) ] : <EOL> print bench_name <EOL> for name , func in ALL : <EOL> t0 = time . time ( ) <EOL> func ( bench_func ) <EOL> print name , time . time ( ) - t0 </s>
