Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop adding duplicate points to the clusters.
The segmentation system was adding duplicate points to the clusters list before removing them later. This has 2 problems. 1) It is more expensive to remove them later than not to add them. 2) When sorting, multiple slopes can have the same calculated slope value. Depending on the initial order, the duplicates can end up being in non-adjacent slots in the cluster, and won't get de-duplicated later. This takes my sample image on my test box from: 0 init 0.000000 ms 0.000000 ms 1 decimate 0.292000 ms 0.292000 ms 2 blur/sharp 0.000000 ms 0.292000 ms 3 threshold 0.617000 ms 0.909000 ms 4 unionfind 3.746000 ms 4.655000 ms 5 make clusters 9.461000 ms 14.116000 ms 6 fit quads to clusters 16.310000 ms 30.426000 ms 7 quads 0.087000 ms 30.513000 ms 8 decode+refinement 0.869000 ms 31.382000 ms 9 reconcile 0.001000 ms 31.383000 ms 10 debug output 0.001000 ms 31.384000 ms 11 cleanup 0.003000 ms 31.387000 ms to 0 init 0.000000 ms 0.000000 ms 1 decimate 0.303000 ms 0.303000 ms 2 blur/sharp 0.001000 ms 0.304000 ms 3 threshold 0.640000 ms 0.944000 ms 4 unionfind 3.645000 ms 4.589000 ms 5 make clusters 8.593000 ms 13.182000 ms 6 fit quads to clusters 13.935000 ms 27.117000 ms 7 quads 0.084000 ms 27.201000 ms 8 decode+refinement 0.827000 ms 28.028000 ms 9 reconcile 0.002000 ms 28.030000 ms 10 debug output 0.000000 ms 28.030000 ms 11 cleanup 0.004000 ms 28.034000 ms (across 10 runs, and picking one of the faster 10 runs for the original and the slowest for the new) Signed-off-by: Austin Schuh <[email protected]>
- Loading branch information