forked from M-Labs/artiq
1
0
Fork 0

Update performance testbench to include time spent in ARTIQ.

This commit is contained in:
whitequark 2015-07-29 21:28:07 +03:00
parent 3b5d3e2b1a
commit 6d8d0ff3f5
1 changed files with 23 additions and 9 deletions

View File

@ -16,18 +16,32 @@ def main():
engine = diagnostic.Engine() engine = diagnostic.Engine()
engine.process = process_diagnostic engine.process = process_diagnostic
modules = [] # Make sure everything's valid
modules = [Module.from_filename(filename, engine=engine)
for filename in sys.argv[1:]]
def benchmark(f, name):
start = time.perf_counter()
end = 0
runs = 0
while end - start < 5 or runs < 10:
f()
runs += 1
end = time.perf_counter()
print("{} {} runs: {:.2f}s, {:.2f}ms/run".format(
runs, name, end - start, (end - start) / runs * 1000))
sources = []
for filename in sys.argv[1:]: for filename in sys.argv[1:]:
modules.append(Module.from_filename(filename, engine=engine)) with open(filename) as f:
sources.append(f.read())
runs = 100 benchmark(lambda: [Module.from_string(src) for src in sources],
start = time.perf_counter() "ARTIQ typechecking and transforms")
for _ in range(runs):
llobj = OR1KTarget().compile_and_link(modules)
end = time.perf_counter()
print("{} compilation runs: {:.2f}s, {:.2f}ms/run".format( benchmark(lambda: OR1KTarget().compile_and_link(modules),
runs, end - start, (end - start) / runs * 1000)) "LLVM optimization and linking")
if __name__ == "__main__": if __name__ == "__main__":
main() main()