Dan Kortschak
|
91a06ac64c
|
graph/path: reduce allocations in path reconstructions
│ old.bench │ new.bench │
│ sec/op │ sec/op vs base │
ShortestAlts/AllTo_100×2|0.5(17)-8 12.380µ ± 9% 8.577µ ± 6% -30.72% (p=0.000 n=10)
ShortestAlts/AllTo_1000×2|0.5(51)-8 74.87µ ± 17% 47.66µ ± 1% -36.35% (p=0.000 n=10)
ShortestAlts/AllTo_100×4|0.25(53)-8 25.50µ ± 3% 15.35µ ± 3% -39.82% (p=0.000 n=10)
ShortestAlts/AllTo_1000×4|0.25(574)-8 556.5µ ± 5% 279.2µ ± 4% -49.83% (p=0.000 n=10)
ShortestAlts/AllTo_100×16|0.1(76)-8 35.79µ ± 9% 21.71µ ± 3% -39.35% (p=0.000 n=10)
ShortestAlts/AllTo_1000×16|0.1(822)-8 851.8µ ± 6% 400.5µ ± 6% -52.98% (p=0.000 n=10)
AllShortest/AllBetween_100×2|0.5(17)-8 12.482µ ± 6% 8.573µ ± 3% -31.32% (p=0.000 n=10)
AllShortest/AllBetween_1000×2|0.5(51)-8 80.74µ ± 2% 52.90µ ± 4% -34.48% (p=0.000 n=10)
AllShortest/AllBetween_100×4|0.25(53)-8 22.54µ ± 4% 16.17µ ± 4% -28.26% (p=0.000 n=10)
AllShortest/AllBetween_1000×4|0.25(574)-8 543.8µ ± 3% 326.7µ ± 5% -39.93% (p=0.000 n=10)
AllShortest/AllBetween_100×16|0.1(76)-8 31.21µ ± 1% 22.45µ ± 3% -28.07% (p=0.000 n=10)
AllShortest/AllBetween_1000×16|0.1(822)-8 678.4µ ± 1% 402.5µ ± 3% -40.67% (p=0.000 n=10)
ShortestAlts/AllToFunc_100×2|0.5(17)-8 5.892µ ± 2%
ShortestAlts/AllToFunc_1000×2|0.5(51)-8 40.81µ ± 2%
ShortestAlts/AllToFunc_100×4|0.25(53)-8 9.178µ ± 2%
ShortestAlts/AllToFunc_1000×4|0.25(574)-8 214.6µ ± 2%
ShortestAlts/AllToFunc_100×16|0.1(76)-8 12.62µ ± 3%
ShortestAlts/AllToFunc_1000×16|0.1(822)-8 310.7µ ± 3%
AllShortest/AllBetweenFunc_100×2|0.5(17)-8 5.713µ ± 1%
AllShortest/AllBetweenFunc_1000×2|0.5(51)-8 45.68µ ± 3%
AllShortest/AllBetweenFunc_100×4|0.25(53)-8 9.775µ ± 1%
AllShortest/AllBetweenFunc_1000×4|0.25(574)-8 245.2µ ± 5%
AllShortest/AllBetweenFunc_100×16|0.1(76)-8 13.76µ ± 1%
AllShortest/AllBetweenFunc_1000×16|0.1(822)-8 314.7µ ± 1%
geomean 82.87µ 43.03µ -38.14%
│ old.bench │ new.bench │
│ B/op │ B/op vs base │
ShortestAlts/AllTo_100×2|0.5(17)-8 14.148Ki ± 0% 9.727Ki ± 0% -31.25% (p=0.000 n=10)
ShortestAlts/AllTo_1000×2|0.5(51)-8 189.8Ki ± 0% 127.5Ki ± 0% -32.80% (p=0.000 n=10)
ShortestAlts/AllTo_100×4|0.25(53)-8 22.32Ki ± 0% 14.99Ki ± 0% -32.83% (p=0.000 n=10)
ShortestAlts/AllTo_1000×4|0.25(574)-8 1272.9Ki ± 0% 681.9Ki ± 0% -46.42% (p=0.000 n=10)
ShortestAlts/AllTo_100×16|0.1(76)-8 33.23Ki ± 0% 22.66Ki ± 0% -31.79% (p=0.000 n=10)
ShortestAlts/AllTo_1000×16|0.1(822)-8 1799.9Ki ± 0% 953.2Ki ± 0% -47.04% (p=0.000 n=10)
AllShortest/AllBetween_100×2|0.5(17)-8 13.039Ki ± 0% 8.617Ki ± 0% -33.91% (p=0.000 n=10)
AllShortest/AllBetween_1000×2|0.5(51)-8 181.5Ki ± 0% 119.3Ki ± 0% -34.29% (p=0.000 n=10)
AllShortest/AllBetween_100×4|0.25(53)-8 21.34Ki ± 0% 14.01Ki ± 0% -34.35% (p=0.000 n=10)
AllShortest/AllBetween_1000×4|0.25(574)-8 1264.8Ki ± 0% 673.8Ki ± 0% -46.72% (p=0.000 n=10)
AllShortest/AllBetween_100×16|0.1(76)-8 32.24Ki ± 0% 21.68Ki ± 0% -32.76% (p=0.000 n=10)
AllShortest/AllBetween_1000×16|0.1(822)-8 1791.8Ki ± 0% 945.1Ki ± 0% -47.25% (p=0.000 n=10)
ShortestAlts/AllToFunc_100×2|0.5(17)-8 6.922Ki ± 0%
ShortestAlts/AllToFunc_1000×2|0.5(51)-8 119.8Ki ± 0%
ShortestAlts/AllToFunc_100×4|0.25(53)-8 9.531Ki ± 0%
ShortestAlts/AllToFunc_1000×4|0.25(574)-8 611.1Ki ± 0%
ShortestAlts/AllToFunc_100×16|0.1(76)-8 13.12Ki ± 0%
ShortestAlts/AllToFunc_1000×16|0.1(822)-8 870.7Ki ± 0%
AllShortest/AllBetweenFunc_100×2|0.5(17)-8 5.812Ki ± 0%
AllShortest/AllBetweenFunc_1000×2|0.5(51)-8 111.5Ki ± 0%
AllShortest/AllBetweenFunc_100×4|0.25(53)-8 8.547Ki ± 0%
AllShortest/AllBetweenFunc_1000×4|0.25(574)-8 603.0Ki ± 0%
AllShortest/AllBetweenFunc_100×16|0.1(76)-8 12.14Ki ± 0%
AllShortest/AllBetweenFunc_1000×16|0.1(822)-8 862.6Ki ± 0%
geomean 126.5Ki 68.27Ki -37.99%
│ old.bench │ new.bench │
│ allocs/op │ allocs/op vs base │
ShortestAlts/AllTo_100×2|0.5(17)-8 141.00 ± 0% 94.00 ± 0% -33.33% (p=0.000 n=10)
ShortestAlts/AllTo_1000×2|0.5(51)-8 420.0 ± 0% 269.0 ± 0% -35.95% (p=0.000 n=10)
ShortestAlts/AllTo_100×4|0.25(53)-8 279.0 ± 0% 174.0 ± 0% -37.63% (p=0.000 n=10)
ShortestAlts/AllTo_1000×4|0.25(574)-8 2.888k ± 0% 1.741k ± 0% -39.72% (p=0.000 n=10)
ShortestAlts/AllTo_100×16|0.1(76)-8 395.0 ± 0% 244.0 ± 0% -38.23% (p=0.000 n=10)
ShortestAlts/AllTo_1000×16|0.1(822)-8 4.128k ± 0% 2.485k ± 0% -39.80% (p=0.000 n=10)
AllShortest/AllBetween_100×2|0.5(17)-8 136.00 ± 0% 89.00 ± 0% -34.56% (p=0.000 n=10)
AllShortest/AllBetween_1000×2|0.5(51)-8 415.0 ± 0% 264.0 ± 0% -36.39% (p=0.000 n=10)
AllShortest/AllBetween_100×4|0.25(53)-8 275.0 ± 0% 170.0 ± 0% -38.18% (p=0.000 n=10)
AllShortest/AllBetween_1000×4|0.25(574)-8 2.884k ± 0% 1.737k ± 0% -39.77% (p=0.000 n=10)
AllShortest/AllBetween_100×16|0.1(76)-8 391.0 ± 0% 240.0 ± 0% -38.62% (p=0.000 n=10)
AllShortest/AllBetween_1000×16|0.1(822)-8 4.124k ± 0% 2.481k ± 0% -39.84% (p=0.000 n=10)
ShortestAlts/AllToFunc_100×2|0.5(17)-8 71.00 ± 0%
ShortestAlts/AllToFunc_1000×2|0.5(51)-8 211.0 ± 0%
ShortestAlts/AllToFunc_100×4|0.25(53)-8 114.0 ± 0%
ShortestAlts/AllToFunc_1000×4|0.25(574)-8 1.156k ± 0%
ShortestAlts/AllToFunc_100×16|0.1(76)-8 160.0 ± 0%
ShortestAlts/AllToFunc_1000×16|0.1(822)-8 1.652k ± 0%
AllShortest/AllBetweenFunc_100×2|0.5(17)-8 66.00 ± 0%
AllShortest/AllBetweenFunc_1000×2|0.5(51)-8 206.0 ± 0%
AllShortest/AllBetweenFunc_100×4|0.25(53)-8 110.0 ± 0%
AllShortest/AllBetweenFunc_1000×4|0.25(574)-8 1.152k ± 0%
AllShortest/AllBetweenFunc_100×16|0.1(76)-8 156.0 ± 0%
AllShortest/AllBetweenFunc_1000×16|0.1(822)-8 1.648k ± 0%
geomean 649.3 336.5 -37.70%
|
2023-04-24 20:31:56 +09:30 |
|
Dan Kortschak
|
8f6a7707f4
|
graph/internal/ordered: replace slice sort types with sort.Slice calls
|
2021-10-14 07:01:58 +10:30 |
|
Dan Kortschak
|
3d5d9d4a35
|
graph/path: allow incremental Bellman-Ford search
The impact on the current implementation is negligible.
name old time/op new time/op delta
BellmanFordFrom/500_tenth-8 4.14ms ± 1% 4.11ms ± 1% -0.73% (p=0.001 n=10+9)
BellmanFordFrom/1000_tenth-8 16.3ms ± 1% 16.1ms ± 1% -0.82% (p=0.000 n=10+10)
BellmanFordFrom/2000_tenth-8 66.2ms ± 1% 60.9ms ± 0% -8.08% (p=0.000 n=10+9)
BellmanFordFrom/500_half-8 18.0ms ± 5% 16.9ms ± 1% -6.28% (p=0.000 n=10+9)
BellmanFordFrom/1000_half-8 68.5ms ± 2% 67.4ms ± 1% -1.50% (p=0.000 n=9+8)
BellmanFordFrom/2000_half-8 281ms ± 1% 276ms ± 1% -1.45% (p=0.000 n=9+10)
BellmanFordFrom/500_full-8 33.4ms ± 0% 33.0ms ± 1% -1.29% (p=0.000 n=9+9)
BellmanFordFrom/1000_full-8 137ms ± 1% 133ms ± 0% -3.11% (p=0.000 n=8+9)
BellmanFordFrom/2000_full-8 549ms ± 1% 546ms ± 1% ~ (p=0.065 n=10+9)
name old alloc/op new alloc/op delta
BellmanFordFrom/500_tenth-8 142kB ± 0% 142kB ± 0% ~ (p=0.110 n=10+9)
BellmanFordFrom/1000_tenth-8 284kB ± 0% 284kB ± 0% ~ (p=0.382 n=10+10)
BellmanFordFrom/2000_tenth-8 624kB ± 0% 624kB ± 0% ~ (p=0.956 n=10+10)
BellmanFordFrom/500_half-8 142kB ± 0% 142kB ± 0% ~ (p=0.666 n=10+10)
BellmanFordFrom/1000_half-8 284kB ± 0% 284kB ± 0% ~ (p=0.070 n=10+8)
BellmanFordFrom/2000_half-8 624kB ± 0% 624kB ± 0% ~ (p=0.290 n=10+10)
BellmanFordFrom/500_full-8 142kB ± 0% 142kB ± 0% ~ (p=0.234 n=9+10)
BellmanFordFrom/1000_full-8 284kB ± 0% 284kB ± 0% ~ (p=0.051 n=10+9)
BellmanFordFrom/2000_full-8 624kB ± 0% 624kB ± 0% ~ (p=0.790 n=9+10)
name old allocs/op new allocs/op delta
BellmanFordFrom/500_tenth-8 2.03k ± 0% 2.03k ± 0% ~ (all equal)
BellmanFordFrom/1000_tenth-8 4.03k ± 0% 4.03k ± 0% ~ (all equal)
BellmanFordFrom/2000_tenth-8 8.03k ± 0% 8.03k ± 0% ~ (all equal)
BellmanFordFrom/500_half-8 2.03k ± 0% 2.03k ± 0% ~ (p=0.294 n=10+8)
BellmanFordFrom/1000_half-8 4.03k ± 0% 4.03k ± 0% ~ (all equal)
BellmanFordFrom/2000_half-8 8.03k ± 0% 8.03k ± 0% ~ (all equal)
BellmanFordFrom/500_full-8 2.03k ± 0% 2.03k ± 0% ~ (p=1.000 n=10+10)
BellmanFordFrom/1000_full-8 4.03k ± 0% 4.03k ± 0% ~ (all equal)
BellmanFordFrom/2000_full-8 8.03k ± 0% 8.03k ± 0% ~ (p=1.000 n=10+10)
The performance of the lazy implementation is a little worse and allocations
are a lot worse than the eager implementation. This reflects that the benchmark
is performed on a graph with a single connected component which gains no benefit
from the incremental approach but suffers the cost of repeated reallocation for
appends.
name new time/op inc time/op delta
BellmanFordFrom/500_tenth-8 4.11ms ± 1% 4.28ms ± 1% +4.05% (p=0.000 n=9+10)
BellmanFordFrom/1000_tenth-8 16.1ms ± 1% 16.0ms ± 6% ~ (p=0.143 n=10+10)
BellmanFordFrom/2000_tenth-8 60.9ms ± 0% 62.8ms ± 0% +3.13% (p=0.000 n=9+10)
BellmanFordFrom/500_half-8 16.9ms ± 1% 17.5ms ± 1% +3.97% (p=0.000 n=9+10)
BellmanFordFrom/1000_half-8 67.4ms ± 1% 70.0ms ± 2% +3.76% (p=0.000 n=8+9)
BellmanFordFrom/2000_half-8 276ms ± 1% 285ms ± 0% +2.91% (p=0.000 n=10+10)
BellmanFordFrom/500_full-8 33.0ms ± 1% 35.5ms ± 5% +7.40% (p=0.000 n=9+10)
BellmanFordFrom/1000_full-8 133ms ± 0% 137ms ± 2% +3.48% (p=0.000 n=9+9)
BellmanFordFrom/2000_full-8 546ms ± 1% 592ms ± 6% +8.42% (p=0.000 n=9+10)
name new alloc/op inc alloc/op delta
BellmanFordFrom/500_tenth-8 142kB ± 0% 182kB ± 0% +27.84% (p=0.000 n=9+10)
BellmanFordFrom/1000_tenth-8 284kB ± 0% 363kB ± 0% +27.94% (p=0.000 n=10+10)
BellmanFordFrom/2000_tenth-8 624kB ± 0% 893kB ± 0% +43.26% (p=0.000 n=10+10)
BellmanFordFrom/500_half-8 142kB ± 0% 182kB ± 0% +27.83% (p=0.000 n=10+10)
BellmanFordFrom/1000_half-8 284kB ± 0% 363kB ± 0% +27.90% (p=0.000 n=8+10)
BellmanFordFrom/2000_half-8 624kB ± 0% 893kB ± 0% +43.25% (p=0.000 n=10+10)
BellmanFordFrom/500_full-8 142kB ± 0% 182kB ± 0% +27.82% (p=0.000 n=10+10)
BellmanFordFrom/1000_full-8 284kB ± 0% 363kB ± 0% +27.89% (p=0.000 n=9+10)
BellmanFordFrom/2000_full-8 624kB ± 0% 893kB ± 0% +43.23% (p=0.000 n=10+10)
name new allocs/op inc allocs/op delta
BellmanFordFrom/500_tenth-8 2.03k ± 0% 2.10k ± 0% +3.50% (p=0.000 n=8+8)
BellmanFordFrom/1000_tenth-8 4.03k ± 0% 4.12k ± 0% +2.39% (p=0.000 n=10+10)
BellmanFordFrom/2000_tenth-8 8.03k ± 0% 8.17k ± 0% +1.77% (p=0.000 n=10+10)
BellmanFordFrom/500_half-8 2.03k ± 0% 2.10k ± 0% +3.49% (p=0.000 n=8+10)
BellmanFordFrom/1000_half-8 4.03k ± 0% 4.12k ± 0% +2.36% (p=0.000 n=9+10)
BellmanFordFrom/2000_half-8 8.03k ± 0% 8.17k ± 0% +1.77% (p=0.000 n=8+10)
BellmanFordFrom/500_full-8 2.03k ± 0% 2.10k ± 0% +3.50% (p=0.000 n=10+10)
BellmanFordFrom/1000_full-8 4.03k ± 0% 4.12k ± 0% +2.36% (p=0.000 n=9+10)
BellmanFordFrom/2000_full-8 8.03k ± 0% 8.17k ± 0% +1.76% (p=0.000 n=10+10)
|
2021-01-07 06:43:24 +10:30 |
|
Dan Kortschak
|
9ae0689dae
|
graph/path: add option to retain all paths from single-source path finding routines
|
2020-07-10 07:22:35 +09:30 |
|
Dan Kortschak
|
3bedd58622
|
graph/path: properly report negative cycles in Shortest.To
We still use the maxEdges condition to allow a better exploration of the graph
before terminating.
|
2020-07-07 06:20:59 +09:30 |
|
Dan Kortschak
|
8d4cfcdeb8
|
graph/path: fix error messages
|
2020-07-02 15:56:32 +09:30 |
|
Egon Elbre
|
b6ceadb9b7
|
graph/path: make tests parallel
|
2020-03-16 16:10:59 +02:00 |
|
Dan Kortschak
|
6b03bc22e1
|
graph: use int64 for node retrieval
|
2018-03-24 09:21:44 +10:30 |
|
kortschak
|
805531d142
|
all: change capitalization of gonum in license header
|
2017-11-02 06:54:08 +10:30 |
|
kortschak
|
7ba61f0ead
|
graph/...: remove Weight method from Edge
|
2017-08-24 10:21:15 +09:30 |
|
kortschak
|
15ecc07d40
|
graph/path/...: update for int64 IDs
|
2017-07-02 08:38:42 +09:30 |
|
kortschak
|
7af70dd796
|
all: fix many go vet errors
|
2017-06-20 16:29:35 +09:30 |
|
Brendan Tracey
|
d33397aa65
|
all: change import paths
|
2017-05-23 00:03:03 -06:00 |
|
Brendan Tracey
|
059a6c43f9
|
graph: imported graph as a subtree
|
2017-05-23 00:02:59 -06:00 |
|