Commit aee0221
committed
qsort: add benchmarks from the standard library
These will let us be more confident that a custom sort algorithm makes
sense to use, especially when e.g. the Go standard library introduces
a new sorting algorithm, we can compare the two.
On my Mac, using the pdqsort from Go 1.19, the relevant timings are:
Sort8/100000-10 4.91ms ± 0%
Sort8/1000000-10 60.1ms ± 0%
StdlibSort8/100000-10 8.16ms ± 0%
StdlibSort8/1000000-10 103ms ± 0%
Sort8/100000-10 163MB/s ± 0%
Sort8/1000000-10 133MB/s ± 0%
StdlibSort8/100000-10 98.0MB/s ± 0%
StdlibSort8/1000000-10 77.5MB/s ± 0%
Compared to the Go 1.18 sort algorithm:
Sort8/100000-10 4.90ms ± 0%
Sort8/1000000-10 59.0ms ± 0%
StdlibSort8/100000-10 8.53ms ± 0%
StdlibSort8/1000000-10 105ms ± 0%
Sort8/100000-10 163MB/s ± 0%
Sort8/1000000-10 136MB/s ± 0%
StdlibSort8/100000-10 93.8MB/s ± 0%
StdlibSort8/1000000-10 76.0MB/s ± 0%
So the Go standard library sort performance is improving but we are
still about 40% faster than the benchmark.1 parent 3e23660 commit aee0221
1 file changed
+31
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
162 | 165 | | |
163 | 166 | | |
164 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
165 | 193 | | |
166 | 194 | | |
167 | 195 | | |
| |||
222 | 250 | | |
223 | 251 | | |
224 | 252 | | |
| 253 | + | |
225 | 254 | | |
226 | 255 | | |
227 | 256 | | |
| |||
238 | 267 | | |
239 | 268 | | |
240 | 269 | | |
241 | | - | |
242 | 270 | | |
243 | 271 | | |
244 | 272 | | |
| 273 | + | |
245 | 274 | | |
| 275 | + | |
246 | 276 | | |
247 | 277 | | |
248 | 278 | | |
0 commit comments