Closed Bug 1362806 Opened 4 years ago Closed 4 years ago

Optimize NS_GetDefaultPort() for HTTP(S)

Categories

(Core :: Networking, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

References

Details

Attachments

(1 file)

See this perf profile:

-    0.00%  Web Content  libxul.so  [.] imgLoader::LoadImage                                                  ▒
   - imgLoader::LoadImage                                                                                     ▒
      - 2.10% mozilla::net::HttpChannelChild::AsyncOpen2                                                      ▒
         + 1.75% mozilla::net::HttpChannelChild::AsyncOpen                                                    ▒
         - 0.34% nsContentSecurityManager::doContentSecurityCheck                                             ◆
            + 0.17% NS_CheckContentLoadPolicy                                                                 ▒
            - 0.13% nsContentSecurityManager::CheckChannel                                                    ▒
                 NS_HasBeenCrossOrigin                                                                        ▒
                 mozilla::BasePrincipal::CheckMayLoad                                                         ▒
               - ContentPrincipal::MayLoadInternal                                                            ▒
                  - 0.08% NS_SecurityCompareURIs                                                              ▒
                     - NS_GetRealPort                                                                         ▒
                        - 0.05% NS_GetDefaultPort                                                             ▒
                             net_EnsureIOService                                                              ▒
                             mozilla::services::GetIOService                                                  ▒
                        + 0.04% mozilla::net::nsStandardURL::GetScheme                                        ▒
                    0.05% nsACString::Finalize                                                                ▒
              0.05% mozilla::net::LoadInfo::GetExternalContentPolicyType                                      ▒

NS_SecurityCompareURIs()'s cost is totally from NS_GetDefaultPort, which is all XPCOM overhead.  :-(

I have a simple patch that optimizes the HTTP/HTTPS case away, I propose we hardcode these two schemes, and stick to XPCOM purity for the rest?
Attachment #8865156 - Flags: review?(mcmanus)
Assignee: nobody → ehsan
Comment on attachment 8865156 [details] [diff] [review]
Optimize NS_GetDefaultPort() for HTTP(S)

Review of attachment 8865156 [details] [diff] [review]:
-----------------------------------------------------------------

thanks - we'll take small easy wins.
Attachment #8865156 - Flags: review?(mcmanus) → review+
Pushed by eakhgari@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/98d1dd932bc6
Optimize NS_GetDefaultPort() for HTTP(S); r=mcmanus
https://hg.mozilla.org/mozilla-central/rev/98d1dd932bc6
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.