-
Notifications
You must be signed in to change notification settings - Fork 934
Extend IAccessOptimizer to support getting/setting single property value #1944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend IAccessOptimizer to support getting/setting single property value #1944
Conversation
Here are some performance numbers of the added [Get\Set]PropertyValue methods:
|
…ertyValueInvoker delegates
…tion for isBytecodeProviderImpl field
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think it is a better approach than #1942.
@@ -163,10 +163,10 @@ private static void EmitCastToReference(ILGenerator il, System.Type type) | |||
|
|||
private GetPropertyValueInvoker GenerateGetPropertyValueMethod(IGetter getter) | |||
{ | |||
if (getter == null) | |||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot the null
case... Now that we do no more yield just null when the argument is not optimizable, the case where it is null has to be handled separately, because the null coalesce operator does not work on method groups. (And the ternary requires some explicit casting.)
This is an alternative approach (#1942) to avoid reflection when
UseReflectionOptimizer
enabled. Here I was forced to use IL asIOptimizableSetter
exposes only anEmit
method. I think that this approach is better, but is also more invasive and contains some ugly code to avoid a breaking change.