Commit 3355a02
committed
internal/rangekey: reduce range-key iteration allocations
Remove the two remaining excess allocations incured when iterating with range
keys enabled, in the absence of any committed range keys. This brings the
number of allocations to parity with iteration with points only.
The two removed allocations stemmed from use of closures constructed at
iteration construction. These closures have been replaced with interfaces.
```
name old time/op new time/op delta
IteratorScan/keys=100,r-amp=1,key-types=points-only-10 5.76µs ± 0% 5.87µs ± 0% +1.86% (p=0.000 n=8+8)
IteratorScan/keys=100,r-amp=1,key-types=points-and-ranges-10 8.81µs ± 2% 8.81µs ± 3% ~ (p=0.684 n=10+10)
IteratorScan/keys=100,r-amp=3,key-types=points-only-10 10.1µs ± 2% 10.4µs ± 3% ~ (p=0.063 n=10+10)
IteratorScan/keys=100,r-amp=3,key-types=points-and-ranges-10 13.4µs ± 3% 13.8µs ± 1% +2.83% (p=0.022 n=10+9)
IteratorScan/keys=100,r-amp=7,key-types=points-only-10 15.5µs ± 0% 15.7µs ± 2% +1.41% (p=0.028 n=9+10)
IteratorScan/keys=100,r-amp=7,key-types=points-and-ranges-10 18.8µs ± 1% 19.0µs ± 2% ~ (p=0.123 n=10+10)
IteratorScan/keys=100,r-amp=10,key-types=points-only-10 19.0µs ± 1% 19.2µs ± 1% ~ (p=0.146 n=10+8)
IteratorScan/keys=100,r-amp=10,key-types=points-and-ranges-10 22.7µs ± 2% 22.9µs ± 2% +0.99% (p=0.011 n=10+10)
IteratorScan/keys=1000,r-amp=1,key-types=points-only-10 44.5µs ± 0% 44.8µs ± 1% +0.60% (p=0.002 n=10+9)
IteratorScan/keys=1000,r-amp=1,key-types=points-and-ranges-10 71.8µs ± 0% 71.5µs ± 3% ~ (p=0.052 n=10+10)
IteratorScan/keys=1000,r-amp=3,key-types=points-only-10 77.4µs ± 1% 77.4µs ± 0% ~ (p=0.633 n=10+8)
IteratorScan/keys=1000,r-amp=3,key-types=points-and-ranges-10 104µs ± 0% 104µs ± 1% -0.43% (p=0.023 n=10+10)
IteratorScan/keys=1000,r-amp=7,key-types=points-only-10 104µs ± 1% 104µs ± 1% ~ (p=0.393 n=10+10)
IteratorScan/keys=1000,r-amp=7,key-types=points-and-ranges-10 132µs ± 1% 133µs ± 0% ~ (p=0.063 n=10+10)
IteratorScan/keys=1000,r-amp=10,key-types=points-only-10 118µs ± 1% 118µs ± 1% ~ (p=0.853 n=10+10)
IteratorScan/keys=1000,r-amp=10,key-types=points-and-ranges-10 145µs ± 0% 145µs ± 1% ~ (p=0.579 n=10+10)
IteratorScan/keys=10000,r-amp=1,key-types=points-only-10 417µs ± 0% 418µs ± 0% ~ (p=0.113 n=10+9)
IteratorScan/keys=10000,r-amp=1,key-types=points-and-ranges-10 671µs ± 0% 667µs ± 2% -0.54% (p=0.043 n=10+10)
IteratorScan/keys=10000,r-amp=3,key-types=points-only-10 708µs ± 2% 719µs ± 1% +1.54% (p=0.004 n=10+9)
IteratorScan/keys=10000,r-amp=3,key-types=points-and-ranges-10 971µs ± 1% 973µs ± 2% ~ (p=0.739 n=10+10)
IteratorScan/keys=10000,r-amp=7,key-types=points-only-10 948µs ± 1% 965µs ± 3% +1.82% (p=0.004 n=10+10)
IteratorScan/keys=10000,r-amp=7,key-types=points-and-ranges-10 1.20ms ± 1% 1.22ms ± 1% +1.22% (p=0.004 n=10+10)
IteratorScan/keys=10000,r-amp=10,key-types=points-only-10 1.05ms ± 1% 1.07ms ± 1% +1.86% (p=0.000 n=10+10)
IteratorScan/keys=10000,r-amp=10,key-types=points-and-ranges-10 1.31ms ± 1% 1.32ms ± 1% +1.17% (p=0.000 n=10+9)
name old alloc/op new alloc/op delta
IteratorScan/keys=100,r-amp=1,key-types=points-only-10 16.0B ± 0% 16.0B ± 0% ~ (all equal)
IteratorScan/keys=100,r-amp=1,key-types=points-and-ranges-10 48.0B ± 0% 16.0B ± 0% -66.67% (p=0.000 n=10+10)
IteratorScan/keys=100,r-amp=3,key-types=points-only-10 48.0B ± 0% 48.0B ± 0% ~ (all equal)
IteratorScan/keys=100,r-amp=3,key-types=points-and-ranges-10 80.0B ± 0% 48.0B ± 0% -40.00% (p=0.000 n=10+10)
IteratorScan/keys=100,r-amp=7,key-types=points-only-10 112B ± 0% 112B ± 0% ~ (all equal)
IteratorScan/keys=100,r-amp=7,key-types=points-and-ranges-10 144B ± 0% 112B ± 0% -22.22% (p=0.000 n=10+10)
IteratorScan/keys=100,r-amp=10,key-types=points-only-10 160B ± 0% 160B ± 0% ~ (all equal)
IteratorScan/keys=100,r-amp=10,key-types=points-and-ranges-10 192B ± 0% 160B ± 0% -16.67% (p=0.000 n=10+10)
IteratorScan/keys=1000,r-amp=1,key-types=points-only-10 16.0B ± 0% 16.0B ± 0% ~ (all equal)
IteratorScan/keys=1000,r-amp=1,key-types=points-and-ranges-10 48.0B ± 0% 16.0B ± 0% -66.67% (p=0.000 n=9+9)
IteratorScan/keys=1000,r-amp=3,key-types=points-only-10 48.0B ± 0% 48.0B ± 0% ~ (all equal)
IteratorScan/keys=1000,r-amp=3,key-types=points-and-ranges-10 81.0B ± 0% 48.6B ± 1% -40.00% (p=0.000 n=8+10)
IteratorScan/keys=1000,r-amp=7,key-types=points-only-10 113B ± 0% 113B ± 0% ~ (all equal)
IteratorScan/keys=1000,r-amp=7,key-types=points-and-ranges-10 145B ± 0% 113B ± 0% -21.91% (p=0.000 n=10+10)
IteratorScan/keys=1000,r-amp=10,key-types=points-only-10 161B ± 0% 161B ± 0% ~ (all equal)
IteratorScan/keys=1000,r-amp=10,key-types=points-and-ranges-10 194B ± 0% 162B ± 0% -16.49% (p=0.000 n=9+8)
IteratorScan/keys=10000,r-amp=1,key-types=points-only-10 18.8B ±15% 18.8B ±15% ~ (p=1.000 n=10+10)
IteratorScan/keys=10000,r-amp=1,key-types=points-and-ranges-10 54.3B ± 8% 24.0B ± 0% -55.80% (p=0.000 n=10+6)
IteratorScan/keys=10000,r-amp=3,key-types=points-only-10 53.0B ± 8% 53.8B ± 9% ~ (p=0.577 n=10+10)
IteratorScan/keys=10000,r-amp=3,key-types=points-and-ranges-10 88.8B ± 7% 60.4B ± 1% -31.95% (p=0.000 n=10+7)
IteratorScan/keys=10000,r-amp=7,key-types=points-only-10 122B ± 0% 122B ± 0% ~ (p=0.082 n=9+9)
IteratorScan/keys=10000,r-amp=7,key-types=points-and-ranges-10 160B ± 0% 123B ± 6% -23.00% (p=0.000 n=9+10)
IteratorScan/keys=10000,r-amp=10,key-types=points-only-10 169B ± 4% 172B ± 0% ~ (p=0.294 n=10+8)
IteratorScan/keys=10000,r-amp=10,key-types=points-and-ranges-10 206B ± 5% 178B ± 0% -13.51% (p=0.000 n=10+8)
name old allocs/op new allocs/op delta
IteratorScan/keys=100,r-amp=1,key-types=points-only-10 1.00 ± 0% 1.00 ± 0% ~ (all equal)
IteratorScan/keys=100,r-amp=1,key-types=points-and-ranges-10 3.00 ± 0% 1.00 ± 0% -66.67% (p=0.000 n=10+10)
IteratorScan/keys=100,r-amp=3,key-types=points-only-10 3.00 ± 0% 3.00 ± 0% ~ (all equal)
IteratorScan/keys=100,r-amp=3,key-types=points-and-ranges-10 5.00 ± 0% 3.00 ± 0% -40.00% (p=0.000 n=10+10)
IteratorScan/keys=100,r-amp=7,key-types=points-only-10 7.00 ± 0% 7.00 ± 0% ~ (all equal)
IteratorScan/keys=100,r-amp=7,key-types=points-and-ranges-10 9.00 ± 0% 7.00 ± 0% -22.22% (p=0.000 n=10+10)
IteratorScan/keys=100,r-amp=10,key-types=points-only-10 10.0 ± 0% 10.0 ± 0% ~ (all equal)
IteratorScan/keys=100,r-amp=10,key-types=points-and-ranges-10 12.0 ± 0% 10.0 ± 0% -16.67% (p=0.000 n=10+10)
IteratorScan/keys=1000,r-amp=1,key-types=points-only-10 1.00 ± 0% 1.00 ± 0% ~ (all equal)
IteratorScan/keys=1000,r-amp=1,key-types=points-and-ranges-10 3.00 ± 0% 1.00 ± 0% -66.67% (p=0.000 n=10+10)
IteratorScan/keys=1000,r-amp=3,key-types=points-only-10 3.00 ± 0% 3.00 ± 0% ~ (all equal)
IteratorScan/keys=1000,r-amp=3,key-types=points-and-ranges-10 5.00 ± 0% 3.00 ± 0% -40.00% (p=0.000 n=10+10)
IteratorScan/keys=1000,r-amp=7,key-types=points-only-10 7.00 ± 0% 7.00 ± 0% ~ (all equal)
IteratorScan/keys=1000,r-amp=7,key-types=points-and-ranges-10 9.00 ± 0% 7.00 ± 0% -22.22% (p=0.000 n=10+10)
IteratorScan/keys=1000,r-amp=10,key-types=points-only-10 10.0 ± 0% 10.0 ± 0% ~ (all equal)
IteratorScan/keys=1000,r-amp=10,key-types=points-and-ranges-10 12.0 ± 0% 10.0 ± 0% -16.67% (p=0.000 n=10+10)
IteratorScan/keys=10000,r-amp=1,key-types=points-only-10 1.00 ± 0% 1.00 ± 0% ~ (all equal)
IteratorScan/keys=10000,r-amp=1,key-types=points-and-ranges-10 3.00 ± 0% 1.00 ± 0% -66.67% (p=0.000 n=10+10)
IteratorScan/keys=10000,r-amp=3,key-types=points-only-10 3.00 ± 0% 3.00 ± 0% ~ (all equal)
IteratorScan/keys=10000,r-amp=3,key-types=points-and-ranges-10 5.00 ± 0% 3.00 ± 0% -40.00% (p=0.000 n=10+10)
IteratorScan/keys=10000,r-amp=7,key-types=points-only-10 7.00 ± 0% 7.00 ± 0% ~ (all equal)
IteratorScan/keys=10000,r-amp=7,key-types=points-and-ranges-10 9.00 ± 0% 7.00 ± 0% -22.22% (p=0.000 n=10+10)
IteratorScan/keys=10000,r-amp=10,key-types=points-only-10 10.0 ± 0% 10.0 ± 0% ~ (all equal)
IteratorScan/keys=10000,r-amp=10,key-types=points-and-ranges-10 12.0 ± 0% 10.0 ± 0% -16.67% (p=0.000 n=10+10)
```1 parent 4e33626 commit 3355a02
File tree
6 files changed
+78
-51
lines changed- internal
- keyspan
- rangekey
6 files changed
+78
-51
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
22 | 36 | | |
23 | 37 | | |
24 | 38 | | |
25 | 39 | | |
26 | 40 | | |
27 | 41 | | |
28 | 42 | | |
29 | | - | |
| 43 | + | |
30 | 44 | | |
31 | 45 | | |
32 | 46 | | |
| |||
42 | 56 | | |
43 | 57 | | |
44 | 58 | | |
45 | | - | |
| 59 | + | |
46 | 60 | | |
47 | 61 | | |
48 | 62 | | |
| |||
119 | 133 | | |
120 | 134 | | |
121 | 135 | | |
122 | | - | |
| 136 | + | |
123 | 137 | | |
124 | | - | |
125 | | - | |
| 138 | + | |
| 139 | + | |
126 | 140 | | |
127 | 141 | | |
128 | 142 | | |
| |||
140 | 154 | | |
141 | 155 | | |
142 | 156 | | |
143 | | - | |
| 157 | + | |
144 | 158 | | |
145 | 159 | | |
146 | 160 | | |
| |||
307 | 321 | | |
308 | 322 | | |
309 | 323 | | |
310 | | - | |
| 324 | + | |
311 | 325 | | |
312 | 326 | | |
313 | 327 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
28 | 40 | | |
29 | | - | |
| 41 | + | |
30 | 42 | | |
31 | 43 | | |
32 | 44 | | |
33 | | - | |
| 45 | + | |
34 | 46 | | |
35 | 47 | | |
36 | 48 | | |
37 | | - | |
38 | | - | |
| 49 | + | |
| 50 | + | |
39 | 51 | | |
40 | 52 | | |
41 | 53 | | |
42 | 54 | | |
43 | | - | |
| 55 | + | |
44 | 56 | | |
45 | 57 | | |
46 | 58 | | |
| |||
200 | 212 | | |
201 | 213 | | |
202 | 214 | | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
207 | 219 | | |
208 | 220 | | |
209 | 221 | | |
| |||
240 | 252 | | |
241 | 253 | | |
242 | 254 | | |
243 | | - | |
| 255 | + | |
244 | 256 | | |
245 | 257 | | |
246 | 258 | | |
247 | | - | |
248 | | - | |
| 259 | + | |
| 260 | + | |
249 | 261 | | |
250 | 262 | | |
251 | 263 | | |
| |||
727 | 739 | | |
728 | 740 | | |
729 | 741 | | |
730 | | - | |
| 742 | + | |
731 | 743 | | |
732 | 744 | | |
733 | 745 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
| 43 | + | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
92 | 91 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
101 | 100 | | |
102 | 101 | | |
103 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
461 | | - | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
462 | 464 | | |
463 | 465 | | |
464 | 466 | | |
| |||
0 commit comments