Optimise DynamicProxyMetaObject (#1152)

* Remove unnecessary ToArray call.

* Remove Value property.

One use compares with null, so cast to T is a waste.

This leaves just one other use, so it can be inlined.

* Remove _dontFallbackFirst

Is always true. Remove it and branches for it being false.

* Don't use Expression.Convert to reference types to object.

The end-result is a no-op, so don't waste the allocation.
This commit is contained in:
Jon Hanna
2017-01-09 14:44:56 +13:00
committed by James Newton-King
parent cad2ec3a09
commit ea6a21c4f3
4 changed files with 22 additions and 58 deletions
+1 -1
View File
@@ -2365,7 +2365,7 @@ namespace Newtonsoft.Json.Linq
/// </returns>
protected virtual DynamicMetaObject GetMetaObject(Expression parameter)
{
return new DynamicProxyMetaObject<JToken>(parameter, this, new DynamicProxy<JToken>(), true);
return new DynamicProxyMetaObject<JToken>(parameter, this, new DynamicProxy<JToken>());
}
/// <summary>