Efcore: Regression in single context creation perf

Created on 10 Feb 2020  路  8Comments  路  Source: dotnet/efcore

image

area-dbcontext area-perf type-bug

All 8 comments

Suspected commit according to meeting https://github.com/dotnet/efcore/pull/19517/files

Does initializing context also initializes DbSets even if not used?

@smitpatel That's pretty much the only thing that happens before a context is used https://github.com/dotnet/efcore/blob/master/src/EFCore/DbContext.cs#L112

And if we can confirm that https://github.com/dotnet/efcore/pull/19517 caused it we don't have or really can fix it

Should be really easy to simply run the benchmark on the cmdline on both commits to check (let me know if you run into trouble).

Seems like @roji is volunteering to verify the commit for regression.

That was not quite the semantic content of my message... however:

Before change (f98509f442d4b034b42d8130fff48ee0c73d20f0)


BenchmarkDotNet=v0.11.3, OS=ubuntu 19.10
Intel Xeon W-2133 CPU 3.60GHz, 1 CPU, 12 logical and 6 physical cores
.NET Core SDK=3.1.100
  [Host] : .NET Core 3.1.1 (CoreCLR 4.700.19.60701, CoreFX 4.700.19.60801), 64bit RyuJIT

Toolchain=InProcessToolchain  

| Method | Mean | Error | StdDev | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op |
|------------------------------ |---------:|---------:|---------:|------------:|------------:|------------:|--------------------:|
| CreateAndDisposeUnusedContext | 142.0 ms | 1.142 ms | 1.068 ms | 34250.0000 | - | - | 141.75 MB |

After change (dd843a2db241572395fd1c26ba7fc4e7e1e6ba72)


BenchmarkDotNet=v0.11.3, OS=ubuntu 19.10
Intel Xeon W-2133 CPU 3.60GHz, 1 CPU, 12 logical and 6 physical cores
.NET Core SDK=3.1.100
  [Host] : .NET Core 3.1.1 (CoreCLR 4.700.19.60701, CoreFX 4.700.19.60801), 64bit RyuJIT

Toolchain=InProcessToolchain  

| Method | Mean | Error | StdDev | Median | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op |
|------------------------------ |---------:|---------:|---------:|---------:|------------:|------------:|------------:|--------------------:|
| CreateAndDisposeUnusedContext | 193.7 ms | 3.860 ms | 9.825 ms | 188.1 ms | 38000.0000 | - | - | 158.54 MB |


For reference, running is super simple has no hard dependency on @roji:

  • cd benchmark/EFCore.Sqlite.Benchmarks (invert slashes if on exotic operating systems)
  • dotnet run -c Release -f netcoreapp3.1 -- --filter "*CreateAndDisposeUnusedContext*" --inProcess

That was not quite the semantic content of my message... however:

Oops! My mistake! 馃槈

I have ideas.

Was this page helpful?
0 / 5 - 0 ratings