efcore: Set too slow compared to FromSqlRaw()
Challenge
Considering the implementation of a generic Set<T> to fetch data it takes considerably longer than FromSqlRaw<T>.
FromSqlRaw<T>
Set<T>

Both are reading the same record from a view and converting to list using ToList()
Expectation
I would expect the performance to not vary with such great variance.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 31 (20 by maintainers)
@j0nimost I’m sorry, but there’s nothing we can do with a view definition dump…
As you’ve seen above, in an isolated benchmark it doesn’t seem possible to reproduce the dramatic speed difference you are seeing. This most likely means that in your application, you’re somehow doing two completely different things in the two methods, which is the source of the speed difference. I would really advise to try your best to reproduce the speed difference in isolation - possibly by trimming down your application - this would most likely expose the discrepancy between the two methods and help you fix the perf issue.
I’m going to leave this issue open for a while longer in case you can provide more details, but in the absence of an actual repro there’s simply not much we can do to help you…
My comment was before modified one.
@roji Wauw, did not know your benchmarks were public! Cool.
@j0nimost that doesn’t sound like any phenomenon I’m familiar with. If you can submit a minimal repro showing this (preferably in a new issue) we can investigate.
Good job @roji !