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

Performance Issue with EF Core 8.0 and Microsoft.EntityFrameworkCore.DynamicLinq Package #783

Closed
codepassion86 opened this issue Mar 15, 2024 · 8 comments
Assignees

Comments

@codepassion86
Copy link

codepassion86 commented Mar 15, 2024

1. Description

Hello @StefH

I am reaching out to you to report a performance issue encountered with version 8.0 of EF Core, specifically concerning the "Microsoft.EntityFrameworkCore.DynamicLinq ver. 8.3.10" package.

We have observed significant slowdowns (over a minute of waiting) when executing an order by on any query, even when dealing with a minimal number of results (even with just one record). This slowdown occurs only during the initial execution.

We would appreciate any guidance on how to resolve this issue or if there are any updates or alternative solutions available to improve the performance of this package.

Thank you in advance for your attention and assistance regarding this matter.

Best regards.

@StefH
Copy link
Collaborator

StefH commented Mar 15, 2024

Related #781

@codepassion86
Copy link
Author

Ok, but with the .NET 6.0 version this problem did not appear

@StefH StefH self-assigned this Mar 16, 2024
@StefH
Copy link
Collaborator

StefH commented Mar 16, 2024

I did create an example project which uses MS SQL. And tested 6 and 8, not much difference:

(The first query is indeed slower)

.NET 6 (Release mode)

Elapsed time: 1393,0677ms
1, Star Wars Episode IV: A New Hope, 1979, 10
2, Ghostbusters, 1984, 5,5
3, Terminator, 1984, 8,5
4, Taxi Driver, 1976, 5
8, Analyze This, 1999, 10,5
9, Leon: the Professional, 1994, 8,5
10, Mission Impossible, 1996, 8,5
--------------------------------------------------------------------------------
Elapsed time: 4,9237ms
1, Star Wars Episode IV: A New Hope, 1979, 10
2, Ghostbusters, 1984, 5,5
3, Terminator, 1984, 8,5
4, Taxi Driver, 1976, 5
8, Analyze This, 1999, 10,5
9, Leon: the Professional, 1994, 8,5
10, Mission Impossible, 1996, 8,5

.NET 8 (Release mode)

Elapsed time: 1063,9211ms
1, Star Wars Episode IV: A New Hope, 1979, 10
2, Ghostbusters, 1984, 5,5
3, Terminator, 1984, 8,5
4, Taxi Driver, 1976, 5
8, Analyze This, 1999, 10,5
9, Leon: the Professional, 1994, 8,5
10, Mission Impossible, 1996, 8,5
--------------------------------------------------------------------------------
Elapsed time: 5,7117ms
1, Star Wars Episode IV: A New Hope, 1979, 10
2, Ghostbusters, 1984, 5,5
3, Terminator, 1984, 8,5
4, Taxi Driver, 1976, 5
8, Analyze This, 1999, 10,5
9, Leon: the Professional, 1994, 8,5
10, Mission Impossible, 1996, 8,5

See this PR for details
#785

@StefH
Copy link
Collaborator

StefH commented Mar 18, 2024

@codepassion86
The default implementation from the DefaultDynamicLinqCustomTypeProvider.cs is to load all assemblies to search for DynamicLinq types. In case your solution does include a lot of dependencies/assemblies, all these need to be scanned.

In order to limit this, you can build your own provider which implements IDynamicLinqCustomTypeProvider.cs where you only load the assemblies which are required for your application.

@codepassion86
Copy link
Author

@StefH
thx for the suggestion. I will try to do as you wrote.

@StefH
Copy link
Collaborator

StefH commented Apr 6, 2024

@codepassion86
Did you have time yet to validate this?

@codepassion86
Copy link
Author

@StefH
No, I haven't tried what you suggested because I've changed my approach.

@StefH
Copy link
Collaborator

StefH commented May 1, 2024

Closing this in favor of #790

@StefH StefH closed this as completed May 1, 2024
@StefH StefH added bug duplicate and removed bug labels May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants