Selaa lähdekoodia

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 10 vuotta sitten
vanhempi
commit
03712045ff
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  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;
 
 	@:functionCode('
-			if ( !(v is System.ValueType) && System.Object.ReferenceEquals(v, default(T)))
+			if (!typeof(T).IsValueType && System.Object.ReferenceEquals(v, default(T)))
 			{
 				hasValue = false;
 			}