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
Compiled Expressions #3
Conversation
This looks interesting, do you know how much quicker this code is than the original? Cheers Mike |
The expression-based code executes approximately 10x faster on my machine than their reflection-based counterparts. Naturally, real performance metrics vary case by case, but the end result is that these should operate an order of magnitude faster. As for real-world performance, I think on small sites these improvements will be negligible. We may potentially see milliseconds shaved off on sites with many objects and properties being bound per request though. A quick search shows that somebody else has performed these benchmarks too, and they seem to agree with my own testing: http://www.palmmedia.de/Blog/2012/2/4/reflection-vs-compiled-expressions-vs-delegates-performance-comparision Here's the code I used myself to test this. The PropertyUtil class simply contains the property getter/setter code:
|
I will have a go at merging this into a branch tonight and see how it performs. I have a couple of tests designed for testing the general performance of the Framework. |
A quick test with a large number of properties (20) definitely shows a good performance improvement. |
@TomDudfield I have merged this pull into branch pull3 (https://github.com/mikeedwards83/Glass.Mapper/tree/feature/pull3) and fixed the integration tests that broken in Sitecore. Could you take a look at the integration tests for Umbraco? |
I just ran the integration tests for Umbraco and they have all passed. I will pull this into the development branch now. |
I found one issue after the merge to dev detailed in Issue 4 |
Revert of changes by Ralf in commit a603537...
Hi Mike,
I have been experimenting with using compiled expressions as a nice alternative to dynamic IL in order to increase performance of reflection-based APIs at runtime.
To that end, I have integrated the compiled expression equivalents of PropertyInfo's GetValue and SetValue. I have tried to minimize the amount of changes necessary to get this to work, but I did have to change a fair number of unit tests to get them passing with the new functionality. The SiteCore integration tests remain untested however.
If you think that these changes are OK as is, great! However, I also completely understand if you think this needs some reworking. The additional functionality is mostly self contained, so please feel free to re-work the integration aspect as you feel is necessary.
Please let me know if you have any questions, or if there is anything I can do to help.
Thanks,
Chris