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
Compiled model performance trends #33483
Comments
Note: see profiling session done by @muzopraha in #33495: |
This also shows regression for non-compiled models. Is a separate issue needed to track that? |
@stevendarby yeah, that's true - we'll discuss this in the team as well. |
@stevendarby @roji We discussed the regression in 8.0 at the time, and it was considered acceptable because if people had slow model building performance then they could use compiled models! Oh, the irony. |
@ajcvickers Irony aside, it's also not really true in all cases - for example, if you use query filters? |
@stevendarby Agreed. |
Is it a reasonable workaround, for now, to compile the model with EF Core 7, but then upgrade packages and run with v8 or v9? It doesn't crash and burn immediately, but I'd like to know if that's a completely unsupported mix. Thanks. Not sure how surprising this is, but when I encountered this issue, I discovered that AOT doesn't really improve the model init time of compiled models. (Leaving aside the fact queries won't run on AOT). |
No, it's completely unsupported. A "better" workaround would be to use some post-processing script to remove the slow calls added in the newer code. Most of them will be just computed lazily when not using NativeAOT. |
This is the proposed action plan to deal with this regression:
|
In investigating the compiled model changes in EF9, I noticed that things were taking quite a lot longer than expected, so I did some analysis.
The model here is the one used in the samples: https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/CompiledModels
The first issue is that, for this sample model with 449 entity types, 6390 properties, and 720 relationships, the startup time is now worse when using a compiled model.
By startup time, I mean wall clock time to run the following:
My suspicion that a lot of this is assembly loading and/or JIT, based on the increase in DLL size across releases:
Related to all this is that the time to run
dotnet ef dbcontext optimize
on this same model has increased very dramatically in EF9.dbcontext optimize
(s)The text was updated successfully, but these errors were encountered: