4 ms·
I think the point of measuring is good, and even if we're only talking about hashmaps and vectors, the point is clear to me. It's probably predictable that a ve
by ninjakeyboard 11y ago
I think the point of measuring is good, and even if we're only talking about hashmaps and vectors, the point is clear to me. It's probably predictable that a vector be at least on-par with a small map but if we consider what the impact on performance is when we call that op millions of times a second it becomes clear. I think you're right about the use-case as well - eg in building distributed systems with consistent hashing to determine which node to use. That's a real use case where routing logic performance may actually have some impact (still probably not going to be the worst part of the problem). Eg Cassandra by default has a hash with 64 vnodes, and routing happens all over the cluster by what becomes 'co-ordinating nodes'.
At any rate, I'm always hammering the "measure measure measure" message whenever talking about performance as well just because I see how brutally wrong I am every time I take guesses about where time is spent. Every engineer worth their salt (I hope) knows from experience that we are almost always wrong about where the time is. It's a good message for us all to be reminded of.