Skip to content

Performance regression in model building in Entity Framework Core 7 #29642

@MaQy

Description

@MaQy

Hi,

I have just migrated an application to Entity Framework Core 7 and noticed that executing the migrations for a new database takes twice or even three times longer than with Entity Framework Core 6. As far as I could see, adding interceptors, the actual SQL statements perform roughly the same, it's the time between migrations that takes longer (I guess building the operations, but I didn't go that deep).

I created a repo with a very simple project to showcase this scenario: https://github.com/MaQy/EfCoreMigrationsBenchmark

Even with just 5 migrations, 4 of them pretty small, the issue can be seen according to the results I got:

Method Runtime Mean Error StdDev
Test .NET 6.0 547.9 ms 302.9 ms 200.4 ms
Test .NET 7.0 1,412.9 ms 421.2 ms 278.6 ms

Include provider and version information

EF Core version: 7.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 7.0
Operating system: Windows 11 21H2
IDE: Visual Studio 2022 17.4

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions