Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

[NoMerge] For davidfowl #1320

Closed
wants to merge 29 commits into from
Closed

[NoMerge] For davidfowl #1320

wants to merge 29 commits into from

Conversation

benaadams
Copy link
Contributor

@benaadams benaadams commented Jan 23, 2017

@davidfowl wanted some numbers

Following changes merged

Change #1318
Change #1313
Change #1308
Change #1301

Needs aspnet/HttpAbstractions#757 for the changes
And aspnet/Benchmarks#170 to use benchmarks repo with changes

Kestrel benchmark testing

Before dotnet run -c Release RequestParsing

                   Method |          Mean |      StdDev | Scaled |          RPS | Allocated |
------------------------- |-------------- |------------ |------- |------------- |---------- |
           ParsePlaintext |   752.8983 ns |  30.0983 ns |   1.00 | 1,328,200.67 |     103 B |
  ParsePipelinedPlaintext |   590.5970 ns |   4.6015 ns |   0.79 | 1,693,202.05 |     103 B |
          ParseLiveAspNet | 3,669.5090 ns |  82.0207 ns |   4.88 |   272,516.02 |   1.09 kB |
 ParsePipelinedLiveAspNet | 3,337.8771 ns |  61.1607 ns |   4.44 |   299,591.61 |    1.1 kB |
             ParseUnicode | 6,073.9618 ns |  84.9393 ns |   8.08 |   164,637.19 |   1.92 kB |
    ParseUnicodePipelined | 5,895.0197 ns | 110.8188 ns |   7.84 |   169,634.72 |   1.92 kB |

After

                   Method |          Mean |      StdDev | Scaled |          RPS | Allocated |
------------------------- |-------------- |------------ |------- |------------- |---------- |
           ParsePlaintext |   703.4463 ns |   6.1967 ns |   1.00 | 1,421,572.54 |     103 B |
  ParsePipelinedPlaintext |   577.9539 ns |   6.4741 ns |   0.82 | 1,730,241.75 |     103 B |
          ParseLiveAspNet | 3,308.9771 ns | 100.9436 ns |   4.70 |   302,208.20 |   1.09 kB |
 ParsePipelinedLiveAspNet | 3,051.5007 ns |  50.2546 ns |   4.34 |   327,707.61 |    1.1 kB |
             ParseUnicode | 5,751.9464 ns | 109.8296 ns |   8.18 |   173,854.19 |   1.92 kB |
    ParseUnicodePipelined | 5,407.8456 ns | 126.0240 ns |   7.69 |   184,916.52 |   1.92 kB |

Before dotnet run -c Release ResponseHeaders

        Method |                 Type |          Mean |     StdDev |           RPS | Allocated |
-------------- |--------------------- |-------------- |----------- |-------------- |---------- |
    SetHeaders |            Plaintext |   156.8055 ns |  4.4623 ns |  6,377,325.86 |      31 B |
 OutputHeaders |            Plaintext |   146.2860 ns |  1.3579 ns |  6,835,924.41 |       0 B |
    SetHeaders |               Common | 1,410.4890 ns | 13.9366 ns |    708,973.99 |      31 B |
 OutputHeaders |               Common |   839.1053 ns |  5.5641 ns |  1,191,745.56 |       0 B |
    SetHeaders | ContentLengthNumeric |    86.6333 ns |  1.3831 ns | 11,542,906.01 |      31 B |
 OutputHeaders | ContentLengthNumeric |    78.5276 ns |  1.0887 ns | 12,734,383.25 |       0 B |
    SetHeaders |  ContentLengthString |    58.3702 ns |  0.7405 ns | 17,132,040.17 |       0 B |
 OutputHeaders |  ContentLengthString |    74.1068 ns |  0.8684 ns | 13,494,037.03 |       0 B |
    SetHeaders |              Unknown | 2,427.5306 ns | 25.6492 ns |    411,941.26 |      31 B |
 OutputHeaders |              Unknown | 1,222.1461 ns | 15.1807 ns |    818,232.77 |       0 B |

After

        Method |                 Type |          Mean |     StdDev |           RPS |
-------------- |--------------------- |-------------- |----------- |-------------- |
    SetHeaders |            Plaintext |    73.3054 ns |  1.1412 ns | 13,641,558.38 |
 OutputHeaders |            Plaintext |   135.1715 ns |  2.0847 ns |  7,398,011.34 |
    SetHeaders |               Common |   870.6936 ns | 13.5975 ns |  1,148,509.71 |
 OutputHeaders |               Common |   733.3460 ns |  7.1410 ns |  1,363,612.85 |
    SetHeaders | ContentLengthNumeric |    40.9641 ns |  0.6048 ns | 24,411,630.07 |
 OutputHeaders | ContentLengthNumeric |    71.3207 ns |  0.7880 ns | 14,021,166.89 |
    SetHeaders |  ContentLengthString |    71.5608 ns |  0.8682 ns | 13,974,127.54 |
 OutputHeaders |  ContentLengthString |    69.7093 ns |  1.0001 ns | 14,345,296.90 |
    SetHeaders |              Unknown | 1,402.3272 ns | 14.9522 ns |    713,100.31 |
 OutputHeaders |              Unknown | 1,082.5272 ns | 13.1398 ns |    923,764.28 |

Append() before 80 bytes, after 64 bytes zeroed
AppendNonPrimaryHeaders() before 888 bytes, after 48 bytes zeroed
Reduces stack from 296 to 216 bytes
Also drops one of the header scans (2 scans now rather than 3)
Copy ulong per loop, less variables, split multiblock into own path
@benaadams
Copy link
Contributor Author

@CesarBS found the benchmark start issue; if you include a src project in global.json; you also need to include it in the Performance global.json otherwise it compiles, rerestores, compiles and first test errors as compile hasn't written when it starts. Is a bit weird

@benaadams benaadams closed this Jan 23, 2017
@cesarblum
Copy link
Contributor

@benaadams Are you referring to #1314 (comment)? Problem is we don't have global.json anymore.

@benaadams benaadams deleted the for-davidfowl branch March 27, 2018 05:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants