forked from mikepound/mazesolving
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.py
More file actions
39 lines (34 loc) · 717 Bytes
/
profile.py
File metadata and controls
39 lines (34 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
from bprofile import BProfile
import tempfile
from solve import solve
from factory import SolverFactory
methods = [
"astar",
# "breadthfirst",
# "depthfirst",
"dijkstra",
# "leftturn",
]
inputs = [
# "tiny",
# "small",
# "normal",
# "braid200",
"logo",
"combo400",
"braid2k",
"perfect2k",
# "perfect4k",
# "combo6k",
# "perfect10k",
# "vertical15k",
]
def profile():
for m in methods:
for i in inputs:
with tempfile.NamedTemporaryFile(suffix='.png') as tmp:
solve(SolverFactory(), m, "examples/%s.png" % i, tmp.name)
profiler = BProfile('profiler.png')
with profiler:
profile()