The Map is to take the Swiss-table layout

This commit is contained in:
Joseph Ferano 2026-09-25 09:44:59 +07:00
parent af4da764b2
commit 7a1d9c1263

View File

@ -1264,7 +1264,8 @@ Removal landed, with the loop the spec predicted as its cost. Deferring it was
what had kept the implementation free of tombstones and of Odin's what had kept the implementation free of tombstones and of Odin's
backward-shift loop; taking it is taking the loop. backward-shift loop; taking it is taking the loop.
** TODO The Map is slower than CPython's dict at a million entries ** NEXT The Map is slower than CPython's dict at a million entries
Decided 2026-09-25: build the Swiss-table layout, one metadata byte a slot. Measured against the current Map at small, game and large sizes before and after.
Keys, values and hashes are three separate runs, so a lookup that misses Keys, values and hashes are three separate runs, so a lookup that misses
everything costs three cache misses where a compact dict costs two. One byte of everything costs three cache misses where a compact dict costs two. One byte of
metadata a slot — the Swiss-table arrangement — is the known answer and is not metadata a slot — the Swiss-table arrangement — is the known answer and is not