Explorar o código

Remove unnecessary GC allocation inside Null. Calling "v is ValueType" on a value type requires boxing it, whereas typeof(T).IsValueType does not require boxing.

Dan Ogles %!s(int64=10) %!d(string=hai) anos
pai
achega
03712045ff
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      std/cs/internal/Null.hx

+ 1 - 1
std/cs/internal/Null.hx

@@ -47,7 +47,7 @@ package cs.internal;
 	@:readOnly public var hasValue(default,never):Bool;
 	@:readOnly public var hasValue(default,never):Bool;
 
 
 	@:functionCode('
 	@:functionCode('
-			if ( !(v is System.ValueType) && System.Object.ReferenceEquals(v, default(T)))
+			if (!typeof(T).IsValueType && System.Object.ReferenceEquals(v, default(T)))
 			{
 			{
 				hasValue = false;
 				hasValue = false;
 			}
 			}