소스 검색

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 년 전
부모
커밋
03712045ff
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  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;
 			}