3 ms·
Apparently linear search now beats hashmap if you have less than TWO HUNDRED elements. Crazy!
by inigyou 2mo ago
Apparently linear search now beats hashmap if you have less than TWO HUNDRED elements. Crazy!
- afdbcreid 2mo agoBut when you compare native integers, not something more complicated, right?
- zbentley 2mo agoDepends. Are you searching for the complicated thing by identity, or in a system that caches identities and/or interns objects of the type you’re handling? All Of those can result in searches being word-based and thus vectorizable/cache-sympathetic more often.
- spockz 2mo agoSo now the result of `new HashMap<>()` should be backed by an array for the first 200 elements or so? Potentially the size depending on the L1 size etc.
- SkiFire13 2mo agoFor which key types, hashmap implementation, and hasher? Depending on these factors hashmaps performance can vary a lot.