| > O(n^2) I do not dispute. "Landmines," however, I take offense at: my naive implementation can still check 10,000 items in less than three seconds If you're satisfied that the loop you presented runs for a time comparable
with three seconds for merely 10000 elements, it says plenty enough about your
craft. > [...] I can tell you that Dictionary<string, Item> is roughly 8% slower than HashSet<string> for two otherwise identical implementations of this method. Ah yes, benchmark comparing non-implementation (abstract class) with an
implementation (concrete class). > From the preceding conversation, I conclude that you are inclined to prematurely optimize at the cost of maintainability No. I just tend not to leave behind ridiculous algorithms, especially when an
acceptably efficient solution is of comparable code complexity. > [...] You may not think that this description accurately depicts you; but then I don't think your opinion of me seems to be correct either. Parts of it, yes, they do match. I'm an asshole that laughs openly whenever
sees statements that look ridiculous made by somebody who considers themselves
an expert (note that it doesn't matter whether they are or are not actually an
expert). But then, it's not my code that takes three seconds to walk through
ten thousands elements when -- as napkin calculations show -- it should take
under a millisecond. |