forked from M-Labs/artiq
Update performance testbench to include time spent in ARTIQ.
This commit is contained in:
parent
3b5d3e2b1a
commit
6d8d0ff3f5
|
@ -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
|
||||||
for filename in sys.argv[1:]:
|
modules = [Module.from_filename(filename, engine=engine)
|
||||||
modules.append(Module.from_filename(filename, engine=engine))
|
for filename in sys.argv[1:]]
|
||||||
|
|
||||||
runs = 100
|
def benchmark(f, name):
|
||||||
start = time.perf_counter()
|
start = time.perf_counter()
|
||||||
for _ in range(runs):
|
end = 0
|
||||||
llobj = OR1KTarget().compile_and_link(modules)
|
runs = 0
|
||||||
|
while end - start < 5 or runs < 10:
|
||||||
|
f()
|
||||||
|
runs += 1
|
||||||
end = time.perf_counter()
|
end = time.perf_counter()
|
||||||
|
|
||||||
print("{} compilation runs: {:.2f}s, {:.2f}ms/run".format(
|
print("{} {} runs: {:.2f}s, {:.2f}ms/run".format(
|
||||||
runs, end - start, (end - start) / runs * 1000))
|
runs, name, end - start, (end - start) / runs * 1000))
|
||||||
|
|
||||||
|
sources = []
|
||||||
|
for filename in sys.argv[1:]:
|
||||||
|
with open(filename) as f:
|
||||||
|
sources.append(f.read())
|
||||||
|
|
||||||
|
benchmark(lambda: [Module.from_string(src) for src in sources],
|
||||||
|
"ARTIQ typechecking and transforms")
|
||||||
|
|
||||||
|
benchmark(lambda: OR1KTarget().compile_and_link(modules),
|
||||||
|
"LLVM optimization and linking")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue