fsharp/fsharp — pull request #238 by jack-pappas (2014-01-11 17:25:56+00:00)
Title: Optimize structural equality/comparison for reference types

I've implemented a patch for the augmentation phase of the F# compiler, so that the structural equality/comparison methods generated for reference types (e.g., records) check for physical equality. This greatly improves performance in cases where an instance is being compared to itself, especially when the type has been carefully implemented to maximize structure-sharing (for example, see PR #219). When the two instances are not identical, the structural equality/comparison checks proceed as usual.

To complement this optimization, I've uncommented (or newly implemented) checks for physical equality of array elements (when possible) in the structural equality/comparison implementations for arrays which are included in `FSharp.Core`. This makes it faster to compare arrays whose element type is a reference type.