IronLanguages/main — pull request #70 by KeithJRome (2012-05-09 21:21:03+00:00)
Title: Fix for "Duplicate key in dict" issue

This is a pretty scary class, seemingly optimized for concurrent access. Even though the change I made to fix this nasty little bug is pretty small, I would appreciate a second set of eyes on the solution before merging.

I am particularly concerned that fixing the bug will mean that inserting new dictionary values will become a guaranteed O(n) operation instead of the current O(1) cost. I just didn't see any way around that.

Updates to existing entries should still be O(1). It's the inserts that will be impacted.

Issue was reported and discussed here: http://ironpython.codeplex.com/workitem/32527

* Additionally, while trying to decipher the code in this class I noticed that there appears to be no way to ever compact the storage. It will grow when needed, but I see no mechanism for compacting back down short of clearing and reloading or copying the entries to a new dict. I'm not even sure that compaction is even something to be too concerned about, but it seems odd that it would be omitted when the rest of the implementation appears to be so focused on efficiency.