Skip to content

Commit 207fce9

Browse files
docs: update benchmark with A*
1 parent a7517b4 commit 207fce9

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ python setup.py develop
115115

116116
## Performance
117117

118-
I ran the algorithm on a field of ones from the bottom left corner to the top right corner of a 512x512x512 int8 image using a 3.7 GHz Intel i7-4920K CPU. Unidirectional search takes about 39.5 seconds (3.4 MVx/sec) with a maximum memory usage of about 1300 MB. In the unidirectional case, this test forces the algorithm to process nearly all of the volume (dijkstra aborts early when the target is found). In the bidirectional case, the volume is processed in about 11.5 seconds (11.7 MVx/sec) with a peak memory usage of about 2300 MB.
118+
I ran three algorithms on a field of ones from the bottom left corner to the top right corner of a 512x512x512 int8 image using a 3.7 GHz Intel i7-4920K CPU. Unidirectional search takes about 42 seconds (3.2 MVx/sec) with a maximum memory usage of about 1300 MB. In the unidirectional case, this test forces the algorithm to process nearly all of the volume (dijkstra aborts early when the target is found). In the bidirectional case, the volume is processed in about 11.8 seconds (11.3 MVx/sec) with a peak memory usage of about 2300 MB. The A* version processes the volume in 0.5 seconds (268.4 MVx/sec) with an identical memory profile to unidirectional search. A* works very well in this simple case, but may not be superior in all configurations.
119119

120120
Theoretical unidirectional memory allocation breakdown: 128 MB source image, 512 MB distance field, 512 MB parents field (1152 MB). Theoretical bidirectional memory allocation breakdown: 128 MB source image, 2x 512 distance field, 2x 512 MB parental field (2176 MB).
121121

122122
<p style="font-style: italics;" align="center">
123-
<img height=384 src="https://raw.githubusercontent.com/seung-lab/dijkstra3d/master/dijkstra3d.png" alt="Fig. 1: A benchmark of dijkstra.dijkstra run on a 512^3 voxel field of ones from bottom left source to top right target. (black) bidirectional search (blue) unidirectional search." /><br>
124-
Fig. 1: A benchmark of dijkstra.dijkstra run on a 512<sup>3</sup> voxel field of ones from bottom left source to top right target. (black) bidirectional search (blue) unidirectional search.
123+
<img height=384 src="https://raw.githubusercontent.com/seung-lab/dijkstra3d/master/dijkstra3d.png" alt="Fig. 1: A benchmark of dijkstra.dijkstra run on a 512<sup>3</sup> voxel field of ones from bottom left source to top right target. (black) unidirectional search (blue) bidirectional search (red) A* search aka compass=True." /><br>
124+
Fig. 1: A benchmark of dijkstra.dijkstra run on a 512<sup>3</sup> voxel field of ones from bottom left source to top right target. (black) unidirectional search (blue) bidirectional search (red) A* search aka <code>compass=True</code>.
125125
</p>
126126

127127
```python
@@ -130,10 +130,12 @@ import time
130130
import dijkstra3d
131131

132132
field = np.ones((512,512,512), order='F', dtype=np.int8)
133+
source = (0,0,0)
134+
target = (511,511,511)
133135

134-
s = time.time()
135-
path = dijkstra3d.dijkstra(x, source=(0,0,0), target=(511, 511, 511), bidirectional=True) # or False
136-
print(time.time() - s)
136+
path = dijkstra3d.dijkstra(field, source, target) # black line
137+
path = dijkstra3d.dijkstra(field, source, target, bidirectional=True) # blue line
138+
path = dijkstra3d.dijkstra(field, source, target, compass=True) # red line
137139
```
138140

139141

dijkstra3d.png

-803 Bytes
Loading

0 commit comments

Comments
 (0)