Entity Framework spinup much slower on x64 vs x86

后端 未结 1 1401
星月不相逢
星月不相逢 2020-12-08 15:21

My coworker posted this question yesterday: 7-second EF startup time even for tiny DbContext.

After taking his code and moving it to a separate solution to isolate i

1条回答
  •  [愿得一人]
    2020-12-08 16:12

    The issue is fully reproducible. I have just run it and used dotTrace Performance profiler to collect snapshots for both x86 and x64 executions. I got mostly same times as you report. But there is really no obvious difference between x64 and x86 traces - except the x64 takes at least twice the time of x86 everywhere.

    But that was tracing of NUnit test run. By running the same test just as console applications I get times like this:

    x86: 0,6864012, 0,0468001
    x64: 1,0608019, 0,0468001
    

    That looks much better, doesn't it? There is still difference between x86 and x64 but the x64 code can be slower in general for some operations.

    The problem at this point is not about EF but about NUnit and its test runner.

    Edit:

    I did some more testing. Both NUnit's and Resharper's task runner has this issue but it affects only the very first test. All other tests run quickly. xUnit shows the same behavior.

    0 讨论(0)
提交回复
热议问题