Unity structs should implement the IEquatable interface

Implementing the IEquatable interface on the unity structs (Vector3, etc) should provide a performance increase when using these structures in the generic contains no?

I’ve been looking at this today and while in general I agree after having read that same blog post, it would seem that the reason they don’t do this is because it requires JIT compiling to work. If you call Contains on a List of structs that implement IEquatable, it will try to JIT compile a System.Collections.Generic.GenericEqualityComparer for that type. Looks like this:

00:29:05	ExecutionEngineException: Attempting to JIT compile method 'System.Collections.Generic.GenericEqualityComparer`1<Point3>:.ctor
00:29:05	()' while running with --aot-only.
00:29:05	
00:29:05	  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod*,object,object[],S
00:29:05	ystem.Exception&)
00:29:05	  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.
00:29:05	Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
00:29:05	Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
00:29:05	  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.
00:29:05	Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
00:29:05	  at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters
00:29:05	, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
00:29:05	  at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] in <filename unknown>:0
00:29:05	  at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0
00:29:05	  at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0
00:29:05	  at System.Collections.Generic.EqualityComparer`1[Point3]..cctor () [0x00000] in <filename unknown>:0
00:29:05	Rethrow as TypeInitializationException: An exception was thrown by the type initializer for System.Collections.Generic.Equality
00:29:05	Comparer`1
00:29:05	  at System.Array.IndexOf[Point3] (.Point3[] array, Point3 value, Int32 startIndex, Int32 count) [0x00000] in <filename unknown
00:29:05	>:0
00:29:05	  at System.Collections.Generic.List`1[Point3].Contains (Point3 item) [0x00000] in <filename unknown>:0

This happens even if you write a class that sub-classes EqualityComparer. In fact, writing that class and trying to instantiate it will cause the same JIT compile (vs implementing the IEqualityComparer interface). If there is a way to force the compiler to generate the EqualityComparer ahead of time, I would love to know about it.