Repository navigation
Count only the operators that change a query - #32
Merged
Merged
Conversation
MaxOperators counted every call on Queryable, Enumerable and the two Entity Framework extension classes. That included calls that add nothing to the query: ToList and the like, which only say what to hold the results in, and options such as AsNoTracking and AsSplitQuery, which only say how to run it. A projection ends each collection it returns with a ToList, so every projected collection was counted twice. An export selecting eight collections measured 35 against the default of 30, with 9 of those being ToList, AsSplitQuery and AsNoTracking. Not counted now: * ToList, ToArray, ToHashSet, AsEnumerable, AsQueryable * AsNoTracking, AsNoTrackingWithIdentityResolution, AsTracking, AsSplitQuery, AsSingleQuery, IgnoreAutoIncludes, IgnoreQueryFilters, TagWith, TagWithCallSite Include and ThenInclude still count, since each adds to what is loaded. A count can only go down, so no query starts to log or throw. A throw level chosen against the old counts now allows more. Version 0.6.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MaxOperatorscounted every call onQueryable,Enumerableand the two Entity Framework extension classes. That included calls that add nothing to the query:ToListand the like, which only say what to hold the results in.AsNoTrackingandAsSplitQuery, which only say how to run it.A projection ends each collection it returns with a
ToList, so every projected collection was counted twice. The query that prompted this is an export selecting eight collections. It measured 35 against the default of 30, and 9 of those wereToList,AsSplitQueryandAsNoTracking. It now measures 26.No longer counted
ToList,ToArray,ToHashSet,AsEnumerable,AsQueryableAsNoTracking,AsNoTrackingWithIdentityResolution,AsTracking,AsSplitQuery,AsSingleQuery,IgnoreAutoIncludes,IgnoreQueryFilters,TagWith,TagWithCallSiteIncludeandThenIncludestill count, since each adds to what is loaded.Impact
A count can only go down, so no query starts to log or throw. A throw level chosen against the old counts now allows more.
Changes
ShapeAnalyzer.IsOperatordecides what counts.ShapeTests: subqueries count, what holds the results does not, options do not, includes do.MaxOperators.