Hacker News new | ask | show | jobs
by vishbar 2165 days ago
Due to the physical architecture of CPUs/etc., data structures that have "worse" asymptotic performance are often quite a bit faster than those with "better" performance. For example, iterating through a small array to find an item and test for existence is often quite a bit faster than using a hash set for the same operation.
2 comments

In the same vein, pre-processing your data via sorting on some carefully chosen keys can sometimes alleviate the need for purpose built data structures.

And because of caches, sorting can sometimes beat hashtables.

Which is why I just use the standard library.
Most languages have more than one data structure in their standard library.