Skip to content
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

v3: fix benchmark results #1982

Merged
merged 6 commits into from
Aug 7, 2022
Merged

v3: fix benchmark results #1982

merged 6 commits into from
Aug 7, 2022

Conversation

efectn
Copy link
Member

@efectn efectn commented Jul 26, 2022

Some benchmarks make extra allocs after #1928 because of new context's type is interface. This PR aims to fix these benchmarks.

Check:

  • Benchmark_Ctx_MultipartForm
  • Benchmark_Startup_Process
  • Benchmark_Router_Github_API
  • Benchmark_Middleware_BasicAuth
  • Benchmark_Cache
  • Benchmark_Cache_Storage
  • Benchmark_Cache_AdditionalHeaders
  • Benchmark_Cache_MaxSize
  • Benchmark_Limiter

Comparision of master/v3-fix-benchmarks

Benchmark_AcquireCtx-4                                                                    5              0              -100.00%
Benchmark_Ctx_Accepts-4                                                                   0              0              +0.00%
Benchmark_Ctx_AcceptsCharsets-4                                                           0              0              +0.00%
Benchmark_Ctx_AcceptsEncodings-4                                                          0              0              +0.00%
Benchmark_Ctx_AcceptsLanguages-4                                                          0              0              +0.00%
Benchmark_Ctx_Append-4                                                                    0              0              +0.00%
Benchmark_Ctx_Attachment-4                                                                1              1              +0.00%
Benchmark_Ctx_BaseURL-4                                                                   0              0              +0.00%
Benchmark_Ctx_Body_With_Compression-4                                                     7              7              +0.00%
Benchmark_Ctx_BodyParser_JSON-4                                                           6              6              +0.00%
Benchmark_Ctx_BodyParser_XML-4                                                            24             24             +0.00%
Benchmark_Ctx_BodyParser_Form-4                                                           13             13             +0.00%
Benchmark_Ctx_BodyParser_MultipartForm-4                                                  12             12             +0.00%
Benchmark_Ctx_Cookie-4                                                                    0              0              +0.00%
Benchmark_Ctx_Format-4                                                                    0              0              +0.00%
Benchmark_Ctx_Format_HTML-4                                                               0              0              +0.00%
Benchmark_Ctx_Format_JSON-4                                                               1              1              +0.00%
Benchmark_Ctx_Format_XML-4                                                                7              7              +0.00%
Benchmark_Ctx_Fresh_StaleEtag-4                                                           0              0              +0.00%
Benchmark_Ctx_Fresh_WithNoCache-4                                                         0              0              +0.00%
Benchmark_Ctx_IPs-4                                                                       1              1              +0.00%
Benchmark_Ctx_Is-4                                                                        0              0              +0.00%
Benchmark_Ctx_MultipartForm-4                                                             4              8              +100.00%
Benchmark_Ctx_Params-4                                                                    0              0              +0.00%
Benchmark_Ctx_AllParams-4                                                                 2              2              +0.00%
Benchmark_Ctx_Protocol-4                                                                  0              0              +0.00%
Benchmark_Ctx_Subdomains-4                                                                1              1              +0.00%
Benchmark_Ctx_JSON-4                                                                      2              2              +0.00%
Benchmark_Ctx_JSONP-4                                                                     2              2              +0.00%
Benchmark_Ctx_Links-4                                                                     0              0              +0.00%
Benchmark_Ctx_RenderWithLocalsAndBinding-4                                                7              7              +0.00%
Benchmark_Ctx_RedirectToRoute-4                                                           1              1              +0.00%
Benchmark_Ctx_RedirectToRouteWithQueries-4                                                4              4              +0.00%
Benchmark_Ctx_RenderLocals-4                                                              5              5              +0.00%
Benchmark_Ctx_RenderBind-4                                                                5              5              +0.00%
Benchmark_Ctx_Render_Engine-4                                                             5              5              +0.00%
Benchmark_Ctx_Get_Location_From_Route-4                                                   1              1              +0.00%
Benchmark_Ctx_Send-4                                                                      0              0              +0.00%
Benchmark_Ctx_Set-4                                                                       0              0              +0.00%
Benchmark_Ctx_Type-4                                                                      0              0              +0.00%
Benchmark_Ctx_Type_Charset-4                                                              0              0              +0.00%
Benchmark_Ctx_Vary-4                                                                      0              0              +0.00%
Benchmark_Ctx_Write-4                                                                     0              0              +0.00%
Benchmark_Ctx_Writef-4                                                                    1              1              +0.00%
Benchmark_Ctx_XHR-4                                                                       0              0              +0.00%
Benchmark_Ctx_SendString_B-4                                                              0              0              +0.00%
Benchmark_Ctx_QueryParser-4                                                               38             38             +0.00%
Benchmark_Ctx_parseQuery-4                                                                29             29             +0.00%
Benchmark_Ctx_QueryParser_Comma-4                                                         44             44             +0.00%
Benchmark_Ctx_ReqHeaderParser-4                                                           44             44             +0.00%
Benchmark_Ctx_BodyStreamWriter-4                                                          8              8              +0.00%
Benchmark_Utils_getGroupPath-4                                                            2              2              +0.00%
Benchmark_Utils_Unescape-4                                                                1              1              +0.00%
Benchmark_Utils_IsNoCache-4                                                               0              0              +0.00%
Benchmark_SlashRecognition/indexBytes-4                                                   0              0              +0.00%
Benchmark_SlashRecognition/forEach-4                                                      0              0              +0.00%
Benchmark_SlashRecognition/IndexRune-4                                                    0              0              +0.00%
Benchmark_Path_matchParams//api/:param/fixedEnd_|_match_|_/api/abc/fixedEnd-4             0              0              +0.00%
Benchmark_Path_matchParams//api/:param/fixedEnd_|_not_match_|_/api/abc/def/fixedEnd-4     0              0              +0.00%
Benchmark_Path_matchParams//api/v1/:param/*_|_match_|_/api/v1/entity-4                    0              0              +0.00%
Benchmark_Path_matchParams//api/v1/:param/*_|_match_|_/api/v1/entity/-4                   0              0              +0.00%
Benchmark_Path_matchParams//api/v1/:param/*_|_match_|_/api/v1/entity/1-4                  0              0              +0.00%
Benchmark_Path_matchParams//api/v1/:param/*_|_not_match_|_/api/v-4                        0              0              +0.00%
Benchmark_Path_matchParams//api/v1/:param/*_|_not_match_|_/api/v2-4                       0              0              +0.00%
Benchmark_Path_matchParams//api/v1/:param/*_|_not_match_|_/api/v1/-4                      0              0              +0.00%
Benchmark_Path_matchParams//api/v1/:param_|_match_|_/api/v1/entity-4                      0              0              +0.00%
Benchmark_Path_matchParams//api/v1/:param_|_not_match_|_/api/v1/entity/8728382-4          0              0              +0.00%
Benchmark_Path_matchParams//api/v1/:param_|_not_match_|_/api/v1-4                         0              0              +0.00%
Benchmark_Path_matchParams//api/v1/:param_|_not_match_|_/api/v1/-4                        0              0              +0.00%
Benchmark_Path_matchParams//api/v1_|_match_|_/api/v1-4                                    0              0              +0.00%
Benchmark_Path_matchParams//api/v1_|_not_match_|_/api/v2-4                                0              0              +0.00%
Benchmark_Path_matchParams//api/v1/:param/*_|_match_|_/api/v1/entity#01-4                 0              0              +0.00%
Benchmark_Path_matchParams//api/v1/:param/*_|_match_|_/api/v1/entity/#01-4                0              0              +0.00%
Benchmark_Path_matchParams//api/v1/:param/*_|_match_|_/api/v1/entity/1#01-4               0              0              +0.00%
Benchmark_Path_matchParams//api/v1/:param/*_|_not_match_|_/api/v#01-4                     0              0              +0.00%
Benchmark_Path_matchParams//api/v1/:param/*_|_not_match_|_/api/v2#01-4                    0              0              +0.00%
Benchmark_Path_matchParams//api/v1/:param/*_|_not_match_|_/api/v1/#01-4                   0              0              +0.00%
Benchmark_App_MethodNotAllowed-4                                                          3              8              +166.67%
Benchmark_Router_NotFound-4                                                               3              6              +100.00%
Benchmark_Router_Handler-4                                                                0              0              +0.00%
Benchmark_Router_Handler_Strict_Case-4                                                    0              0              +0.00%
Benchmark_Router_Chain-4                                                                  3              6              +100.00%
Benchmark_Router_WithCompression-4                                                        3              6              +100.00%
Benchmark_Startup_Process-4                                                               5606           5607           +0.02%
Benchmark_Router_Next-4                                                                   0              0              +0.00%
Benchmark_Route_Match-4                                                                   0              0              +0.00%
Benchmark_Route_Match_Star-4                                                              0              0              +0.00%
Benchmark_Route_Match_Root-4                                                              0              0              +0.00%
Benchmark_Router_Handler_CaseSensitive-4                                                  0              0              +0.00%
Benchmark_Router_Handler_Unescape-4                                                       0              0              +0.00%
Benchmark_Router_Handler_StrictRouting-4                                                  0              0              +0.00%
Benchmark_Router_Github_API-4                                                             0              0              +0.00%
Benchmark_Middleware_BasicAuth-4                                                          3              5              +66.67%
Benchmark_Cache-4                                                                         2              6              +200.00%
Benchmark_Cache_Storage-4                                                                 5              6              +20.00%
Benchmark_Cache_AdditionalHeaders-4                                                       2              9              +350.00%
Benchmark_Cache_MaxSize/Disabled-4                                                        7              8              +14.29%
Benchmark_Cache_MaxSize/Unlim-4                                                           7              8              +14.29%
Benchmark_Cache_MaxSize/LowBounded-4                                                      7              8              +14.29%
Benchmark_Etag-4                                                                          0              0              +0.00%
Benchmark_Middleware_Favicon-4                                                            1              1              +0.00%
Benchmark_Limiter_Custom_Store-4                                                          2              2              +0.00%
Benchmark_Limiter-4                                                                       1              2              +100.00%
Benchmark_Logger-4                                                                        0              0              +0.00%
Benchmark_Monitor-4                                                                       1              1              +0.00%
Benchmark_Session/default-4                                                               206            206            +0.00%
Benchmark_Session/storage-4                                                               206            206            +0.00%
Benchmark_ToLowerBytes/fiber-4                                                            0              0              +0.00%
Benchmark_ToLowerBytes/default-4                                                          1              1              +0.00%
Benchmark_ToUpperBytes/fiber-4                                                            0              0              +0.00%
Benchmark_ToUpperBytes/default-4                                                          1              1              +0.00%
Benchmark_TrimRightBytes/fiber-4                                                          1              1              +0.00%
Benchmark_TrimRightBytes/default-4                                                        1              1              +0.00%
Benchmark_TrimLeftBytes/fiber-4                                                           1              1              +0.00%
Benchmark_TrimLeftBytes/default-4                                                         1              1              +0.00%
Benchmark_TrimBytes/fiber-4                                                               1              1              +0.00%
Benchmark_TrimBytes/default-4                                                             1              1              +0.00%
Benchmark_EqualFoldBytes/fiber-4                                                          0              0              +0.00%
Benchmark_EqualFoldBytes/default-4                                                        0              0              +0.00%
Benchmark_UUID/fiber-4                                                                    1              1              +0.00%
Benchmark_UUID/default-4                                                                  6              6              +0.00%
Benchmark_ConvertToBytes/fiber-4                                                          0              0              +0.00%
Benchmark_UnsafeString/unsafe-4                                                           0              0              +0.00%
Benchmark_UnsafeString/default-4                                                          1              1              +0.00%
Benchmark_UnsafeBytes/unsafe-4                                                            0              0              +0.00%
Benchmark_UnsafeBytes/default-4                                                           1              1              +0.00%
Benchmark_ToString-4                                                                      2              2              +0.00%
Benchmark_GetMIME/fiber-4                                                                 0              0              +0.00%
Benchmark_GetMIME/default-4                                                               0              0              +0.00%
Benchmark_ParseVendorSpecificContentType/vendorContentType-4                              1              1              +0.00%
Benchmark_ParseVendorSpecificContentType/defaultContentType-4                             0              0              +0.00%
Benchmark_StatusMessage/fiber-4                                                           0              0              +0.00%
Benchmark_StatusMessage/default-4                                                         0              0              +0.00%
Benchmark_ToUpper/fiber-4                                                                 1              1              +0.00%
Benchmark_ToUpper/default-4                                                               1              1              +0.00%
Benchmark_ToLower/fiber-4                                                                 1              1              +0.00%
Benchmark_ToLower/default-4                                                               1              1              +0.00%
Benchmark_TrimRight/fiber-4                                                               0              0              +0.00%
Benchmark_TrimRight/default-4                                                             0              0              +0.00%
Benchmark_TrimLeft/fiber-4                                                                0              0              +0.00%
Benchmark_TrimLeft/default-4                                                              0              0              +0.00%
Benchmark_Trim/fiber-4                                                                    0              0              +0.00%
Benchmark_Trim/default-4                                                                  0              0              +0.00%
Benchmark_Trim/default.trimspace-4                                                        0              0              +0.00%
Benchmark_EqualFold/fiber-4                                                               0              0              +0.00%
Benchmark_EqualFold/default-4                                                             0              0              +0.00%

@efectn efectn added this to the v3 milestone Jul 26, 2022
@efectn
Copy link
Member Author

efectn commented Jul 31, 2022

Benchmark_Router_Github_API was fixed by using acquirectx but other benchmarks should be reviewed. Their problem is probably related as: handler(), next(). If we fix them, everything will be OK.

@efectn efectn merged commit adcb1f2 into v3-beta Aug 7, 2022
@efectn efectn deleted the v3-fix-benchmarks branch August 7, 2022 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants