Feb 11, 2012 at 12:17 AM
Edited Feb 11, 2012 at 12:18 AM
I apologize for the time it has taken to get this in; TR was pretty demanding this week.
I created the fork and checked in my changes. The unit tests seem to run in about the same time as the current trunk.
What's in it:
* I created a compiler constant, FLATTEN_HASHCODES, that will causes the Positions to return 1 for their hash code. This was the best test I could come up with for detecting memoization collisions. When it is set, the unit tests will >30mins to run, but
if they will fail if there are are any collisions where incorrect positions are return from the memo table. Perhaps a secondary build project on your build server could run the tests with this constant set?
* Positions are now IEquatable. Using the constant above, I found that even the patch I sent was insufficent, since it was using IComparable.Compare == 0 as a test for equality (valid for sorting, but not for identity in this case). Please verify that the
comparisons I used are valid in the context of the memo table.
* I buffed the Position hashcodes up a bit for better randomness. Since the unit tests seem to run about the same as the trunk right now, I am not sure whether the dedicated hashcode strategy is any better than the ToString() hashcode strategy you were using
I think the FLATTEN_HASHCODES test is much stronger than any input stream I could come up with (as that stream would be overly sensitive to the hashcode algorithm).
Thoughts? Any changes you would like me to make before requesting a pull?
Next week should be calmer, so if you would like to discuss in person, maybe we could grab lunch or coffee.