def driver(): bench = Benchmark() while 1: res = interp(code, 0, 2500) if bench.stop(): break return res
def driver(): bench = Benchmark() while 1: res = tlr.interpret(tlr.SQUARE, 1764) if bench.stop(): break return res
def ll_main(argv): i = 1 mainargs = () residualargs = () if len(argv) == 2 and argv[1] == '--help': os.write(1, 'usage: ' + argv[0]) for color, decoder in argcolors_decoders: os.write(1, ' ') if color == 'green': os.write(1, decoder.__name__) else: os.write(1, "-const|-var "+decoder.__name__) os.write(1, '\n') return 0 for color, decoder in argcolors_decoders: try: if color == 'green': llvalue = decoder(argv[i]) mainargs += (llvalue,) i = i + 1 else: if argv[i] == '-const': is_const = True elif argv[i] == '-var': is_const = False else: raise ValueError() i += 1 llvalue = decoder(argv[i]) mainargs += (is_const, llvalue) residualargs += (llvalue,) i += 1 except (ValueError, IndexError): j = 1 while j < len(argv): arg = argv[j] if j == i: os.write(1, '--> ') else: os.write(1, ' ') os.write(1, arg+'\n') j += 1 if j == i: os.write(1, '-->\n') return 1 rgenop = RGenOp() generated = ml_generate_code(rgenop, *mainargs) os.write(1, SEPLINE) bench = Benchmark() while 1: try: res = generated(*residualargs) except Exception, e: os.write(1, 'EXCEPTION: %s\n' % (e,)) return 0 if bench.stop(): break