Skip to content

Commit 05c68f3

Browse files
committed
xml服务显式加载预热
1 parent f3a4895 commit 05c68f3

6 files changed

+18
-14
lines changed

WebApiClientCore.Benchmarks/Requests/Benchmark.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ public void GlobalSetup()
5858
.ConfigureHttpClient(c => c.BaseAddress = new Uri("http://webapiclient.com/"));
5959

6060
this.ServiceProvider = services.BuildServiceProvider();
61+
62+
// 服务显式加载预热
6163
this.ServiceProvider.GetService<IWebApiClientCoreJsonApi>();
64+
this.ServiceProvider.GetService<IWebApiClientCoreXmlApi>();
6265
this.ServiceProvider.GetService<IRefitJsonApi>();
66+
this.ServiceProvider.GetService<IRefitXmlApi>();
6367
}
6468

6569
private class JsonResponseHandler : DelegatingHandler

WebApiClientCore.Benchmarks/results/WebApiClientCore.Benchmarks.Requests.HttpGetBenchmark-report-github.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ Job=InProcess Toolchain=InProcessEmitToolchain
99
```
1010
| Method | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio |
1111
|-------------------------- |----------:|----------:|----------:|------:|--------:|-------:|----------:|------------:|
12-
| WebApiClientCore_GetAsync | 5.926 μs | 0.1162 μs | 0.1630 μs | 1.00 | 0.00 | 0.3052 | 3.45 KB | 1.00 |
13-
| Refit_GetAsync | 15.943 μs | 0.2997 μs | 0.3681 μs | 2.70 | 0.10 | 0.4883 | 5.18 KB | 1.50 |
12+
| WebApiClientCore_GetAsync | 5.558 μs | 0.1094 μs | 0.1384 μs | 1.00 | 0.00 | 0.3357 | 3.45 KB | 1.00 |
13+
| Refit_GetAsync | 14.494 μs | 0.2764 μs | 0.3394 μs | 2.61 | 0.10 | 0.4883 | 5.18 KB | 1.50 |

WebApiClientCore.Benchmarks/results/WebApiClientCore.Benchmarks.Requests.HttpGetJsonBenchmark-report-github.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Intel Xeon CPU E5-2650 v2 2.60GHz, 2 CPU, 32 logical and 16 physical cores
77
Job=InProcess Toolchain=InProcessEmitToolchain
88
99
```
10-
| Method | Mean | Error | StdDev | Median | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio |
11-
|------------------------------ |---------:|---------:|---------:|---------:|------:|--------:|-------:|----------:|------------:|
12-
| WebApiClientCore_GetJsonAsync | 11.64 μs | 0.232 μs | 0.495 μs | 11.44 μs | 1.00 | 0.00 | 0.4120 | 4.3 KB | 1.00 |
13-
| Refit_GetJsonAsync | 25.36 μs | 0.496 μs | 0.830 μs | 25.03 μs | 2.19 | 0.13 | 0.5493 | 5.67 KB | 1.32 |
10+
| Method | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio |
11+
|------------------------------ |---------:|---------:|---------:|------:|--------:|-------:|----------:|------------:|
12+
| WebApiClientCore_GetJsonAsync | 11.31 μs | 0.225 μs | 0.322 μs | 1.00 | 0.00 | 0.4120 | 4.3 KB | 1.00 |
13+
| Refit_GetJsonAsync | 29.03 μs | 0.575 μs | 0.788 μs | 2.57 | 0.09 | 0.5493 | 5.67 KB | 1.32 |

WebApiClientCore.Benchmarks/results/WebApiClientCore.Benchmarks.Requests.HttpPostJsonBenchmark-report-github.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ Job=InProcess Toolchain=InProcessEmitToolchain
99
```
1010
| Method | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio |
1111
|------------------------------- |---------:|---------:|---------:|------:|--------:|-------:|----------:|------------:|
12-
| WebApiClientCore_PostJsonAsync | 11.24 μs | 0.223 μs | 0.441 μs | 1.00 | 0.00 | 0.4120 | 4.23 KB | 1.00 |
13-
| Refit_PostJsonAsync | 24.80 μs | 0.487 μs | 0.598 μs | 2.18 | 0.09 | 0.5798 | 6.08 KB | 1.44 |
12+
| WebApiClientCore_PostJsonAsync | 11.26 μs | 0.221 μs | 0.331 μs | 1.00 | 0.00 | 0.4120 | 4.23 KB | 1.00 |
13+
| Refit_PostJsonAsync | 26.16 μs | 0.510 μs | 0.663 μs | 2.32 | 0.08 | 0.5798 | 6.08 KB | 1.44 |

WebApiClientCore.Benchmarks/results/WebApiClientCore.Benchmarks.Requests.HttpPostXmlBenchmark-report-github.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Intel Xeon CPU E5-2650 v2 2.60GHz, 2 CPU, 32 logical and 16 physical cores
77
Job=InProcess Toolchain=InProcessEmitToolchain
88
99
```
10-
| Method | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Gen1 | Allocated | Alloc Ratio |
11-
|------------------------------ |---------:|---------:|---------:|------:|--------:|--------:|-------:|----------:|------------:|
12-
| WebApiClientCore_PostXmlAsync | 48.34 μs | 0.926 μs | 0.866 μs | 1.00 | 0.00 | 3.4180 | - | 35.48 KB | 1.00 |
13-
| Refit_PostXmlAsync | 59.37 μs | 1.180 μs | 2.961 μs | 1.20 | 0.06 | 14.0381 | 2.3193 | 144.38 KB | 4.07 |
10+
| Method | Mean | Error | StdDev | Median | Ratio | RatioSD | Gen0 | Gen1 | Allocated | Alloc Ratio |
11+
|------------------------------ |---------:|---------:|---------:|---------:|------:|--------:|--------:|-------:|----------:|------------:|
12+
| WebApiClientCore_PostXmlAsync | 47.97 μs | 0.943 μs | 2.009 μs | 47.11 μs | 1.00 | 0.00 | 3.4180 | 0.1221 | 35.48 KB | 1.00 |
13+
| Refit_PostXmlAsync | 57.06 μs | 0.948 μs | 0.740 μs | 56.87 μs | 1.21 | 0.02 | 14.0381 | 2.3193 | 144.38 KB | 4.07 |

WebApiClientCore.Benchmarks/results/WebApiClientCore.Benchmarks.Requests.HttpPutFormBenchmark-report-github.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ Job=InProcess Toolchain=InProcessEmitToolchain
99
```
1010
| Method | Mean | Error | StdDev | Median | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio |
1111
|------------------------------ |---------:|---------:|---------:|---------:|------:|--------:|-------:|----------:|------------:|
12-
| WebApiClientCore_PutFormAsync | 20.10 μs | 0.395 μs | 0.470 μs | 19.96 μs | 1.00 | 0.00 | 0.5493 | 5.7 KB | 1.00 |
13-
| Refit_PutFormAsync | 75.53 μs | 1.476 μs | 2.163 μs | 74.24 μs | 3.78 | 0.12 | 1.0986 | 11.57 KB | 2.03 |
12+
| WebApiClientCore_PutFormAsync | 19.94 μs | 0.394 μs | 0.679 μs | 19.62 μs | 1.00 | 0.00 | 0.5493 | 5.7 KB | 1.00 |
13+
| Refit_PutFormAsync | 79.90 μs | 1.551 μs | 2.321 μs | 78.62 μs | 3.98 | 0.17 | 1.0986 | 11.57 KB | 2.03 |

0 commit comments

Comments
 (0)