-
Notifications
You must be signed in to change notification settings - Fork 934
WIP - Use Lambda Expressions for field/property accessor when UseReflectionOptimizer enabled #1942
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
Conversation
…flectionOptimizer enabled
I would rewrite this using dynamic lambda. |
Done, the performance is more or less the same. |
No, it's fine |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
{ | ||
private readonly FieldInfo field; | ||
private readonly System.Type clazz; | ||
private readonly string name; | ||
[NonSerialized] | ||
private Lazy<Func<object, object>> _getDelegate; |
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.
Using a lazy here or in property accessor looks like #1904 laziness, which was rejected: it may reduce start-up time but will cause warming-up more hard to achieve.
And also, the reflection optimizer documentation is crystal clear about that:
The use of the reflection optimizer inflicts a certain startup cost on the application but should lead to better performance in the long run.
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've made an alternative approach (#1944) that avoids this problem.
Replaced by #1944. |
The performance tests shows up to 10 times faster than before for getting or setting a property/field.