Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3eb71bb

Browse files
committedSep 30, 2024·
Switch traversal benchmark to pyinstrument/speedscope
1 parent b455b43 commit 3eb71bb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
 

‎experiments/traversal-benchmark.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,11 @@ def main():
128128
t_end = time()
129129
print(f"Took: {t_end-t_start} secs.")
130130
else:
131-
import vmprof
132-
with open("test.prof", "w+b") as fd:
133-
vmprof.enable(fd.fileno())
131+
import pyinstrument
132+
from pyinstrument.renderers import SpeedscopeRenderer
133+
prof = pyinstrument.Profiler()
134+
with prof:
134135
for _ in range(10_000):
135136
main()
136-
vmprof.disable()
137+
with open("ss.json", "w") as outf:
138+
outf.write(prof.output(SpeedscopeRenderer(show_all=True)))

0 commit comments

Comments
 (0)
Please sign in to comment.