From 03e0189bafcef3cb5b12407ceec0e5cc9f047e92 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Sat, 2 Jun 2018 20:59:34 +0300 Subject: [PATCH 1/2] provide fast generic comparer for bool values --- src/fsharp/FSharp.Core/prim-types.fs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index 560f1ded177..f97591b4abb 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -2162,6 +2162,7 @@ namespace Microsoft.FSharp.Core let FloatComparer = MakeGenericComparer() let Float32Comparer = MakeGenericComparer() let DecimalComparer = MakeGenericComparer() + let BoolComparer = MakeGenericComparer() /// Use a type-indexed table to ensure we only create a single FastStructuralComparison function /// for each type @@ -2199,6 +2200,7 @@ namespace Microsoft.FSharp.Core | ty when ty.Equals(typeof) -> null | ty when ty.Equals(typeof) -> null | ty when ty.Equals(typeof) -> unboxPrim (box StringComparer) + | ty when ty.Equals(typeof) -> null | _ -> MakeGenericComparer<'T>() static let f : System.Collections.Generic.IComparer<'T> = @@ -2218,6 +2220,7 @@ namespace Microsoft.FSharp.Core | ty when ty.Equals(typeof) -> unboxPrim (box Float32Comparer) | ty when ty.Equals(typeof) -> unboxPrim (box DecimalComparer) | ty when ty.Equals(typeof) -> unboxPrim (box StringComparer) + | ty when ty.Equals(typeof) -> unboxPrim (box BoolComparer) | _ -> // Review: There are situations where we should be able // to return System.Collections.Generic.Comparer<'T>.Default here. From 1160fa4ae931320ed51d0da68e3e4cbf57996fdd Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Sun, 3 Jun 2018 09:21:45 +0300 Subject: [PATCH 2/2] formatting --- src/fsharp/FSharp.Core/prim-types.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index f97591b4abb..8ddc523f3a4 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -2220,7 +2220,7 @@ namespace Microsoft.FSharp.Core | ty when ty.Equals(typeof) -> unboxPrim (box Float32Comparer) | ty when ty.Equals(typeof) -> unboxPrim (box DecimalComparer) | ty when ty.Equals(typeof) -> unboxPrim (box StringComparer) - | ty when ty.Equals(typeof) -> unboxPrim (box BoolComparer) + | ty when ty.Equals(typeof) -> unboxPrim (box BoolComparer) | _ -> // Review: There are situations where we should be able // to return System.Collections.Generic.Comparer<'T>.Default here.