-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
When sorting update commands add Deleted + Inserted number of edges instead of Deleted * Inserted #26082
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good.
But can we do a run with context pooling off (as before) to separate perf gains from actual the actual product changes below and perf gains simply from turning on pooling?
{ | ||
return edgeList; | ||
return edges is IEnumerable<TEdge> edgeList ? edgeList : (new TEdge[] { (TEdge)edges! }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like it would allocate more if GetEdges is called multiple times for the same two vertices - is this intentional (e.g. because we never do that?).
We can also continue returnining a List<TEdge>
to keep the typing simpler - the perf difference between a bare array and a List<T>
is very unlikely to matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like it would allocate more if GetEdges is called multiple times for the same two vertices - is this intentional (e.g. because we never do that?).
Yes, it's only called during cycle breaking
We can also continue returnining a List to keep the typing simpler - the perf difference between a bare array and a List is very unlikely to matter.
Can you make it a suggestion? I don't understand how it's simpler
Turning pooling off doesn't have a significant effect on the results
|
…nstead of Deleted * Inserted Don't allocate a collection for edges if there's only one edge between given two vertices Reuse the Multigraph instance
16c2385
to
93f94a1
Compare
Great! |
@Pilchie for approval |
Approved for EFCore 6. |
Description
#25952 decreased throughput in mixed update scenario by about 20-40%. These changes mostly remove this degradation:
Multigraph
instanceBefore #25952
After #25952
After this fix
Customer Impact
SaveChanges
with mixed deletes and inserts is significantly slower.How found
Automated benchmarks
Test coverage
Already covered
Regression?
Yes, from 6.0-rc1
Risk
Low, no functional changes.