> Rule 1. You can't tell where a program is going to spend its time. Bottlenecks occur in surprising places, so don't try to second guess and put in a speed hack until you've proven that's where the bottleneck is. I wish people would follow this rule and just let stuff work. I recently encountered the most extreme version of this I've ever seen in my career: a design review where a guy proposed a Redis caching layer…
This is taken to other extreme many times. Example: Google Chrome codebase was allocating lot of std::string and also someone used a Set to check membership of single item. [1] I mean, if you say like this, many people don't even care about algorithm complexity. Doesn't help that people want to write Python in the monster that is C++. https://groups.google.com/a/chromium.org/forum/m/#!msg/chrom...
Depending on where it was done (fast path or not), this could be just fine.