-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[Perf] Windows/x64: 15 Regressions in Microsoft.Extensions.DependencyInjection #89104
Comments
Regressed in #87183 cc @benjaminpetit |
Same on Linux-x64: Same on Windows-x64 (different machine): |
Tagging subscribers to this area: @dotnet/area-extensions-dependencyinjection Issue DetailsRun Information
Regressions in Microsoft.Extensions.DependencyInjection.TimeToFirstServiceReproGeneral Docs link: https://github.com/dotnet/performance/blob/main/docs/benchmarking-workflow-dotnet-runtime.md git clone https://github.com/dotnet/performance.git
py .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'Microsoft.Extensions.DependencyInjection.TimeToFirstService*' PayloadsMicrosoft.Extensions.DependencyInjection.TimeToFirstService.Transient(Mode: "ILEmit")ETL FilesHistogramDescription of detection logic
JIT DisasmsMicrosoft.Extensions.DependencyInjection.TimeToFirstService.Scoped(Mode: "Expressions")ETL FilesHistogramDescription of detection logic
JIT DisasmsMicrosoft.Extensions.DependencyInjection.TimeToFirstService.Singleton(Mode: "Dynamic")ETL FilesHistogramDescription of detection logic
JIT DisasmsMicrosoft.Extensions.DependencyInjection.TimeToFirstService.Transient(Mode: "Dynamic")ETL FilesHistogramDescription of detection logic
JIT DisasmsMicrosoft.Extensions.DependencyInjection.TimeToFirstService.Singleton(Mode: "Runtime")ETL FilesHistogramDescription of detection logic
JIT DisasmsMicrosoft.Extensions.DependencyInjection.TimeToFirstService.Singleton(Mode: "ILEmit")ETL FilesHistogramDescription of detection logic
JIT DisasmsMicrosoft.Extensions.DependencyInjection.TimeToFirstService.Transient(Mode: "Expressions")ETL FilesHistogramDescription of detection logic
JIT DisasmsMicrosoft.Extensions.DependencyInjection.TimeToFirstService.Transient(Mode: "Runtime")ETL FilesHistogramDescription of detection logic
JIT DisasmsMicrosoft.Extensions.DependencyInjection.TimeToFirstService.Scoped(Mode: "ILEmit")ETL FilesHistogramDescription of detection logic
JIT DisasmsMicrosoft.Extensions.DependencyInjection.TimeToFirstService.Singleton(Mode: "Expressions")ETL FilesHistogramDescription of detection logic
JIT DisasmsMicrosoft.Extensions.DependencyInjection.TimeToFirstService.Scoped(Mode: "Dynamic")ETL FilesHistogramDescription of detection logic
JIT DisasmsMicrosoft.Extensions.DependencyInjection.TimeToFirstService.Scoped(Mode: "Runtime")ETL FilesHistogramDescription of detection logic
JIT DisasmsDocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in Microsoft.Extensions.DependencyInjection.ActivatorUtilitiesBenchmark
ReproGeneral Docs link: https://github.com/dotnet/performance/blob/main/docs/benchmarking-workflow-dotnet-runtime.md git clone https://github.com/dotnet/performance.git
py .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'Microsoft.Extensions.DependencyInjection.ActivatorUtilitiesBenchmark*' PayloadsMicrosoft.Extensions.DependencyInjection.ActivatorUtilitiesBenchmark.CreateInstanceETL FilesHistogramDescription of detection logic
JIT DisasmsDocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in Microsoft.Extensions.DependencyInjection.GetServiceIEnumerable
ReproGeneral Docs link: https://github.com/dotnet/performance/blob/main/docs/benchmarking-workflow-dotnet-runtime.md git clone https://github.com/dotnet/performance.git
py .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'Microsoft.Extensions.DependencyInjection.GetServiceIEnumerable*' PayloadsMicrosoft.Extensions.DependencyInjection.GetServiceIEnumerable.ScopedETL FilesHistogramDescription of detection logic
JIT DisasmsDocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in Microsoft.Extensions.DependencyInjection.GetService
ReproGeneral Docs link: https://github.com/dotnet/performance/blob/main/docs/benchmarking-workflow-dotnet-runtime.md git clone https://github.com/dotnet/performance.git
py .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'Microsoft.Extensions.DependencyInjection.GetService*' PayloadsMicrosoft.Extensions.DependencyInjection.GetService.ScopedETL FilesHistogramDescription of detection logic
JIT DisasmsDocsProfiling workflow for dotnet/runtime repository
|
Regressions were expected due to adding and using the |
I think ~2x slower in dependency injection for transient services is too much of price to pay for something fairly uncommon like Keyed Services. |
We'll need to do some digging here; if it is related to |
I started to investigate a bit; it seems the main culprit is the attributes parsing in the constructor when trying to get the service for the first time. Note that it's only the first GetService for a given type that is slower, subsequent calls to GetService don't seems to be slower than before. It would be interesting to add some case that use the factory method to see if there is any regression. I managed to get some perf back on my local machine, I will open a PR when ready. |
Closing; there are no more active investigations for v8. cc @benjaminpetit Note the recent improvements mentioned in in dotnet/perf-autofiling-issues#20567 and dotnet/perf-autofiling-issues#20580 which essentially get the "scoped" cases back to par (not necessarily first-time usage, but many calls to GetService). |
Run Information
Regressions in Microsoft.Extensions.DependencyInjection.TimeToFirstService
📝 - Benchmark Source
📝 - Benchmark Source
📝 - Benchmark Source
📝 - Benchmark Source
📝 - Benchmark Source
📝 - Benchmark Source
📝 - Benchmark Source
📝 - Benchmark Source
📝 - Benchmark Source
📝 - Benchmark Source
📝 - Benchmark Source
📝 - Benchmark Source
Test Report
Repro
General Docs link: https://github.com/dotnet/performance/blob/main/docs/benchmarking-workflow-dotnet-runtime.md
Payloads
Baseline
Compare
Microsoft.Extensions.DependencyInjection.TimeToFirstService.Transient(Mode: "ILEmit")
ETL Files
Histogram
Description of detection logic
JIT Disasms
Microsoft.Extensions.DependencyInjection.TimeToFirstService.Scoped(Mode: "Expressions")
ETL Files
Histogram
Description of detection logic
JIT Disasms
Microsoft.Extensions.DependencyInjection.TimeToFirstService.Singleton(Mode: "Dynamic")
ETL Files
Histogram
Description of detection logic
JIT Disasms
Microsoft.Extensions.DependencyInjection.TimeToFirstService.Transient(Mode: "Dynamic")
ETL Files
Histogram
Description of detection logic
JIT Disasms
Microsoft.Extensions.DependencyInjection.TimeToFirstService.Singleton(Mode: "Runtime")
ETL Files
Histogram
Description of detection logic
JIT Disasms
Microsoft.Extensions.DependencyInjection.TimeToFirstService.Singleton(Mode: "ILEmit")
ETL Files
Histogram
Description of detection logic
JIT Disasms
Microsoft.Extensions.DependencyInjection.TimeToFirstService.Transient(Mode: "Expressions")
ETL Files
Histogram
Description of detection logic
JIT Disasms
Microsoft.Extensions.DependencyInjection.TimeToFirstService.Transient(Mode: "Runtime")
ETL Files
Histogram
Description of detection logic
JIT Disasms
Microsoft.Extensions.DependencyInjection.TimeToFirstService.Scoped(Mode: "ILEmit")
ETL Files
Histogram
Description of detection logic
JIT Disasms
Microsoft.Extensions.DependencyInjection.TimeToFirstService.Singleton(Mode: "Expressions")
ETL Files
Histogram
Description of detection logic
JIT Disasms
Microsoft.Extensions.DependencyInjection.TimeToFirstService.Scoped(Mode: "Dynamic")
ETL Files
Histogram
Description of detection logic
JIT Disasms
Microsoft.Extensions.DependencyInjection.TimeToFirstService.Scoped(Mode: "Runtime")
ETL Files
Histogram
Description of detection logic
JIT Disasms
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
Run Information
Regressions in Microsoft.Extensions.DependencyInjection.ActivatorUtilitiesBenchmark
📝 - Benchmark Source
Test Report
Repro
General Docs link: https://github.com/dotnet/performance/blob/main/docs/benchmarking-workflow-dotnet-runtime.md
Payloads
Baseline
Compare
Microsoft.Extensions.DependencyInjection.ActivatorUtilitiesBenchmark.CreateInstance
ETL Files
Histogram
Description of detection logic
JIT Disasms
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
Run Information
Regressions in Microsoft.Extensions.DependencyInjection.GetServiceIEnumerable
📝 - Benchmark Source
Test Report
Repro
General Docs link: https://github.com/dotnet/performance/blob/main/docs/benchmarking-workflow-dotnet-runtime.md
Payloads
Baseline
Compare
Microsoft.Extensions.DependencyInjection.GetServiceIEnumerable.Scoped
ETL Files
Histogram
Description of detection logic
JIT Disasms
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
Run Information
Regressions in Microsoft.Extensions.DependencyInjection.GetService
📝 - Benchmark Source
Test Report
Repro
General Docs link: https://github.com/dotnet/performance/blob/main/docs/benchmarking-workflow-dotnet-runtime.md
Payloads
Baseline
Compare
Microsoft.Extensions.DependencyInjection.GetService.Scoped
ETL Files
Histogram
Description of detection logic
JIT Disasms
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
The text was updated successfully, but these errors were encountered: