Commit 9fc3500
Fix: Mix integer key hashes with SplitMix64 (#773)
`std::hash` is the identity for integers on libstdc++ and libc++. Our open-addressing
tables mask that hash into a power-of-2 slot count and probe linearly until an empty
slot, so consecutive keys land in adjacent slots and coalesce into a single contiguous
run. Insertions and lookups both scan that run end to end, making the whole build
quadratic. Closes #770.
Co-Authored-By: Chakshu Dhannawat <65147507+chakshu-dhannawat@users.noreply.github.com>
Co-Authored-By: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>1 parent 749d03b commit 9fc3500
1 file changed
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1277 | 1277 | | |
1278 | 1278 | | |
1279 | 1279 | | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
1280 | 1305 | | |
1281 | 1306 | | |
1282 | 1307 | | |
| |||
0 commit comments