3 ms·
There's a load factor in Swift's Dictionary but it's hardcoded. Same for Rust. (I've maintained both implementations) I assure you the bug is as described. I w
by Gankro 10y ago
There's a load factor in Swift's Dictionary but it's hardcoded. Same for Rust. (I've maintained both implementations)
I assure you the bug is as described. I wrote it up the initial bug report and what needed to be done to mitigate it here [1].
Most critically, my analysis on different sizes demonstrates that it's ultimately a consequence of how hashes are modulo truncated. Increasing the size without increasing capacity (higher load) can in fact decrease execution time.
[1] https://bugs.swift.org/plugins/servlet/mobile#issue/SR-3268 https://bugs.swift.org/plugins/servlet/mobile#issue/SR-3268
(sorry this comment is poorly written, my phone was about to die; read the issue for a proper discussion)