feat: change `IPerformanceService` to return `HttpResponseMessage` by TimothyMakkison · Pull Request #1893 · reactiveui/refit
Change return types from Task<string> to Task<HttpResponseMessage. This makes the benchmarks more accurate as they are intended to measure the cost of configuring and sending a HttpRequestMessage and not the time taken to convert the response into a string.
On a related note why isn't refit using ReadAsStringAsync?
New Benchmark
| Method | Mean | Error | StdDev | Gen0 | Allocated |
|---|---|---|---|---|---|
| ConstantRouteAsync | 2.072 us | 0.0110 us | 0.0097 us | 0.2937 | 2.71 KB |
| DynamicRouteAsync | 2.783 us | 0.0259 us | 0.0202 us | 0.3319 | 3.07 KB |
| ComplexDynamicRouteAsync | 4.060 us | 0.0226 us | 0.0200 us | 0.4044 | 3.78 KB |
| ObjectRequestAsync | 4.954 us | 0.0295 us | 0.0262 us | 0.4807 | 4.48 KB |
| ComplexRequestAsync | 14.455 us | 0.0686 us | 0.0642 us | 1.1597 | 10.67 KB |
Old
| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
|---|---|---|---|---|---|---|
| ConstantRouteAsync | 2.045 us | 0.0395 us | 0.0638 us | 0.6828 | 0.0114 | 6.28 KB |
| DynamicRouteAsync | 2.601 us | 0.0518 us | 0.0532 us | 0.7172 | 0.0038 | 6.6 KB |
| ComplexDynamicRouteAsync | 3.799 us | 0.0651 us | 0.0891 us | 0.7858 | - | 7.24 KB |
| ObjectRequestAsync | 4.560 us | 0.0886 us | 0.1021 us | 0.8698 | - | 8.05 KB |
| ComplexRequestAsync | 12.951 us | 0.2575 us | 0.4643 us | 1.5259 | - | 14.19 KB |