Skip to content

Commit 13bbff5

Browse files
committed
Update benchmarks and small bugfix to Int2IntHashMap.
1 parent 380cdc7 commit 13bbff5

2 files changed

Lines changed: 22 additions & 22 deletions

File tree

docs/DETAILED_BENCHMARKS.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,27 @@ much memory savings.
4343
```
4444
JGraphTSimpleGraph: 1579150656 bytes
4545
GuavaSimpleGraph: 683802456 bytes
46-
MutableSimpleGraph: 121345720 bytes
47-
topology: 120385248 bytes
48-
data: 960472 bytes
46+
MutableSimpleGraph: 116142664 bytes
47+
topology: 115313056 bytes
48+
data: 829608 bytes
4949
ImmutableSimpleGraph: 58755488 bytes
5050
topology: 58082984 bytes
5151
data: 672504 bytes
5252
5353
JGraphTGraph: 1579150656 bytes
5454
GuavaGraph: 792563272 bytes
55-
MutableGraph: 322672448 bytes
56-
topology: 120385248 bytes
57-
data: 202287200 bytes
55+
MutableGraph: 317469392 bytes
56+
topology: 115313056 bytes
57+
data: 202156336 bytes
5858
ImmutableGraph: 260082192 bytes
5959
topology: 58082984 bytes
6060
data: 201999208 bytes
6161
6262
JGraphTNetwork: 1579150672 bytes
6363
GuavaNetwork: 1143011008 bytes
64-
MutableNetwork: 394223992 bytes
65-
topology: 356343072 bytes
66-
data: 37880920 bytes
64+
MutableNetwork: 396506528 bytes
65+
topology: 363787120 bytes
66+
data: 32719408 bytes
6767
ImmutableNetwork: 195711488 bytes
6868
topology: 167848728 bytes
6969
data: 27862760 bytes
@@ -137,16 +137,16 @@ Dijkstra's focuses heavily on edges and weights, and thus this provides a test c
137137

138138
```
139139
Benchmark Mode Cnt Score Error Units
140-
GuavaGraphBenchmark.dijkstras avgt 4 5545.439 ± 550.693 ms/op
141-
GuavaNetworkBenchmark.dijkstras avgt 4 2976.803 ± 376.683 ms/op
142-
JGraphNetworkBenchmark.dijkstras avgt 4 993.315 ± 126.623 ms/op
143-
JGraphGraphBenchmark.dijkstras avgt 4 896.574 ± 66.561 ms/op
144-
MutableGraphBenchmark.dijkstras avgt 4 891.122 ± 30.033 ms/op
145-
MutableNetworkBenchmark.dijkstras avgt 4 654.752 ± 14.063 ms/op
146-
JGraphNetworkBenchmark.dijkstrasJGraph avgt 4 471.196 ± 36.788 ms/op
147-
JGraphGraphBenchmark.dijkstrasJGraph avgt 4 451.695 ± 111.547 ms/op
148-
ImmutableGraphBenchmark.dijkstras avgt 4 429.757 ± 26.303 ms/op
149-
ImmutableNetworkBenchmark.djikstras avgt 4 352.646 ± 13.857 ms/op
140+
GuavaGraphBenchmark.dijkstras avgt 4 5383.428 ± 93.734 ms/op
141+
GuavaNetworkBenchmark.dijkstras avgt 4 3125.794 ± 126.471 ms/op
142+
JGraphNetworkBenchmark.dijkstras avgt 4 905.458 ± 78.649 ms/op
143+
JGraphGraphBenchmark.dijkstras avgt 4 918.595 ± 62.341 ms/op
144+
MutableGraphBenchmark.dijkstras avgt 4 836.289 ± 10.841 ms/op
145+
MutableNetworkBenchmark.dijkstras avgt 4 635.534 ± 9.620 ms/op
146+
JGraphGraphBenchmark.dijkstrasJGraph avgt 4 455.715 ± 34.777 ms/op
147+
JGraphNetworkBenchmark.dijkstrasJGraph avgt 4 448.324 ± 18.224 ms/op
148+
ImmutableGraphBenchmark.dijkstras avgt 4 423.763 ± 8.328 ms/op
149+
ImmutableNetworkBenchmark.dijkstras avgt 4 311.660 ± 3.504 ms/op
150150
```
151151

152152
> [!NOTE]

src/main/kotlin/primitives/Int2IntHashMap.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ class Int2IntHashMap(
455455
private var nextKey = 0
456456

457457
init {
458-
if (!containsZero) decrement()
458+
if (entriesLeft > 0 && !containsZero) decrement()
459459
}
460460

461461
private fun numSlots() = if (isHashing()) keysArr.size else arrayUsage
@@ -509,7 +509,7 @@ class Int2IntHashMap(
509509
private var nextValue = zeroValue
510510

511511
init {
512-
if (!containsZero) decrement()
512+
if (entriesLeft > 0 && !containsZero) decrement()
513513
}
514514

515515
private fun numSlots() = if (isHashing()) keysArr.size else arrayUsage
@@ -563,7 +563,7 @@ class Int2IntHashMap(
563563
private var nextEntry = Entry.of(0, zeroValue)
564564

565565
init {
566-
if (!containsZero) decrement()
566+
if (entriesLeft > 0 && !containsZero) decrement()
567567
}
568568

569569
private fun numSlots() = if (isHashing()) keysArr.size else arrayUsage

0 commit comments

Comments
 (0)