Skip to content

Commit

Permalink
Switch traversal benchmark to pyinstrument/speedscope
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Sep 30, 2024
1 parent b455b43 commit 3eb71bb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions experiments/traversal-benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ def main():
t_end = time()
print(f"Took: {t_end-t_start} secs.")
else:
import vmprof
with open("test.prof", "w+b") as fd:
vmprof.enable(fd.fileno())
import pyinstrument
from pyinstrument.renderers import SpeedscopeRenderer
prof = pyinstrument.Profiler()
with prof:
for _ in range(10_000):
main()
vmprof.disable()
with open("ss.json", "w") as outf:
outf.write(prof.output(SpeedscopeRenderer(show_all=True)))

0 comments on commit 3eb71bb

Please sign in to comment.