-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Performance degradation of Expression.Lambda<TDelegate>
in netcore
#32767
Performance degradation of Expression.Lambda<TDelegate>
in netcore
#32767
Comments
Unnecessary cache call in Expression.Lambda<TDelegate> (with reflection in worst scenario) has been removed. Fix dotnet#32767
@stephentoub, @karelz please take a look |
This package was archived: https://github.com/dotnet/runtime/blob/master/docs/area-owners.md see #27790 for details. |
@vchirikov thanks for investigating this issue and providing a fix. We will consider fixes for performance regressions. |
@cston , thanks. |
Unnecessary cache call in Expression.Lambda<TDelegate> (with reflection in worst scenario) has been removed. Fix #32767
I also worked with this issue. I created benchmark, which reproduces the slowdown in our use case.
This is very common scenario, when we use ORM and IQueriable. As a workaround in version 3.1 we can
As a quick fix we choose option 1 and hope, for patch in net core 3.1.x |
Hi, after the migration from netfx to netcore we observed a performance degradation in places with intensive usage of
Expression
.After profiling and research we found a reason of this, it was
Expression.Lambda<TDelegate>
call.I assume that this PR is the reason of this performance degradation.
To summarize, before this changes we called the generic constructor. After the changes firstly we search in the cache (cache size is 50) if we have cache-miss we will use reflection and will replace one row in the cache.
I think the cache isn't necessary for generic
Expression.Lambda<TDelegate>
method.I have prepared and built my own runtime fork with a fix and also did a benchmark for a cache-miss situation.
Benchmark:
Fix here: #32768
--
p.s. I fixed the benchmark, now it shows the cache-miss situation better
The text was updated successfully, but these errors were encountered: