From 8d09300155385e16ac63b8c118b3b7e52821a03b Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Fri, 20 Sep 2013 16:22:10 +0200 Subject: [PATCH] Improve speed of MPC by about 30% Dear diary, I spend a whole day searching for why this implementation of the MPC was slower then my own implementation. I checked *everything*. I rewrote the front evolution to match with mine almost exactly. I was about to give up. And then I saw this... Arg! --- skimage/graph/_mcp.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skimage/graph/_mcp.pyx b/skimage/graph/_mcp.pyx index 42985a37..23d433f9 100644 --- a/skimage/graph/_mcp.pyx +++ b/skimage/graph/_mcp.pyx @@ -290,7 +290,7 @@ cdef class MCP: self.flat_cumulative_costs.fill(np.inf) self.dim = len(costs.shape) self.costs_shape = costs.shape - self.costs_heap = heap.FastUpdateBinaryHeap(initial_capacity=size, + self.costs_heap = heap.FastUpdateBinaryHeap(initial_capacity=128, max_reference=size-1) # This array stores, for each point, the index into the offset