Optimize SQL expression comparison by caching hash codes (currently probably not needed)
Open
area-perf
area-query
customer-reported
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
In the query pipeline sometimes expressions are compared for (deep) equality.
This currently is based on a recursive visit of the subtree, which can be very costly if done multiple times while visiting the expression (it is quite easy to construct expression trees that require O(n^2) operations when visited).
This could be improved by computing a hash that filters out most of the inequalities as suggested in https://github.com/dotnet/efcore/pull/34133#discussion_r1663964197
Contributor guide
Assessment
This issue has not been assessed yet.