Skip to content
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

[release/9.0-staging] Fix to #35239 - EF9: SaveChanges() is significantly slower in .NET9 vs. .NET8 when using .ToJson() Mapping vs. PostgreSQL Legacy POCO mapping #35360

Open
wants to merge 2 commits into
base: release/9.0-staging
Choose a base branch
from

Conversation

maumar
Copy link
Contributor

@maumar maumar commented Dec 19, 2024

Less risky version of the #35326 for patch. If the type TElement type arguments match between element comparer and list comparer, we pass the Equals/Snapshot/Hashcode lambas from element to the list comparer method. Otherwise we fallback to the legacy code, which we know works but constructs redundant comparer objects (perf problem). This is not a real issue however - in reality the legacy code would only be invoked for nested collection scenarios and these are not supported (outside of InMemory). All we really need to do is to construct some Equals, Snapshot and Hashcode expressions (and not throw in the process)

Fixes #35239

@maumar maumar changed the title Fix to #35239 - EF9: SaveChanges() is significantly slower in .NET9 vs. .NET8 when using .ToJson() Mapping vs. PostgreSQL Legacy POCO mapping [release/9.0-staging] Fix to #35239 - EF9: SaveChanges() is significantly slower in .NET9 vs. .NET8 when using .ToJson() Mapping vs. PostgreSQL Legacy POCO mapping Dec 19, 2024
…s. .NET8 when using .ToJson() Mapping vs. PostgreSQL Legacy POCO mapping
@maumar maumar marked this pull request as ready for review December 20, 2024 23:04
@maumar maumar requested a review from AndriySvyryd December 27, 2024 23:08
@maumar
Copy link
Contributor Author

maumar commented Dec 27, 2024

@AndriySvyryd update: added changes to the cosmos StringDictionaryComparer. It does support nested collections and the legacy functions can be invoked (rather than just being constructed like in relational). I added targeted fix similar to what I initially did for main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants