You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HashMap remove: two heap allocations per displaced entry when re-inserting the probe cluster #939
Found in the container survey prompted by #936. The design is sound — FNV hash, open addressing with linear probing, 0.7 load factor, doubling growth, and deletion by clearing the slot and re-inserting the following cluster (correct for linear probing). One hot-path wart:
rt/rt_core.wwith_hashmap_remove: for every occupied slot after the removed one, it does rt_alloc(ksz) + rt_alloc(vsz), memcpy both, clear the slot, with_hashmap_insert, then rt_free_sized both. Two allocator round trips per displaced entry, on every removal from a busy table.
Fix
Re-insert in place: compute the displaced entry's home slot and use backward-shift deletion (move it into the hole if the hole lies between its home and current position), or at least stage the key/value in a fixed stack buffer sized by ksz/vsz (both are known per map) instead of the heap. No semantic change; the existing HashMap fixtures cover correctness. Measure with a remove-heavy fixture (insert 100k, remove 90k) before and after.
Ruling (2026-09-01): the engine comes from the migrated corpora (c-algorithms / TommyDS / STC, migrated whole; M*LIB's B+ tree surgically) with a With facade choosing the winner — see docs/stdlib_sourcing_plan.md and the note on #940. This issue stays open as the facade deliverable.
Activity
ehartford commentedon Sep 2, 2026
Ruling (2026-09-01): the engine comes from the migrated corpora (c-algorithms / TommyDS / STC, migrated whole; M*LIB's B+ tree surgically) with a With facade choosing the winner — see docs/stdlib_sourcing_plan.md and the note on #940. This issue stays open as the facade deliverable.
Complete callable FnAbi descriptors and stdlib Phase 0 (#1129)
C algorithms phase1 (#1142)
D95 + D96: let _ drops; pub const takes its value's type; ?? below |>…