浏览代码

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;
 			}