Closed Bug 632490 Opened 14 years ago Closed 14 years ago

Use a content-type hint for the channel in mozJSSubScriptLoader::LoadSubScript

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0b12
Tracking Status
fennec 2.0b5+ ---

People

(Reporter: mbrubeck, Assigned: mbrubeck)

References

Details

(Keywords: mobile, perf, Whiteboard: [has-patch])

Attachments

(1 file, 1 obsolete file)

Attached patch patch (obsolete) — Splinter Review
Bug 632177 shows that GetMIMEInfoFromOS can be very expensive for Fennec. This function is called by nsFileChannel::MakeFileInputStream, which is triggered by NS_OpenURI when a file: URI is passed to LoadSubScript. This patch avoids the expensive GetMIMEInfoFromOS call by setting a MIME-type "hint" on the channel. Nominating for blocking-fennec because this impacts Fennec startup time (which makes heavy use of LoadSubScript). With this patch plus the patch from bug 632417, I can get all the way through Fennec startup without any calls to GetMIMEInfoFromOS.
Attachment #510695 - Flags: review?(cdleary)
Assignee: general → mbrubeck
Status: NEW → ASSIGNED
Comment on attachment 510695 [details] [diff] [review] patch >- rv = NS_OpenURI(getter_AddRefs(instream), uri, serv, >- nsnull, nsnull, nsIRequest::LOAD_NORMAL, >- getter_AddRefs(chan)); >+ } >+ >+ rv = NS_NewChannel(getter_AddRefs(chan), uri, serv, >+ nsnull, nsnull, nsIRequest::LOAD_NORMAL); >+ if (NS_SUCCEEDED(rv)) >+ { >+ chan->SetContentType(NS_LITERAL_CSTRING("application/javascript")); >+ rv = chan->Open(getter_AddRefs(instream)); >+ } >+ Add a comment here explaining why we don't use the more-concise OpenURI (which would probably like a content-hint overload later?), and r=shaver.
Attachment #510695 - Flags: review?(cdleary) → review+
(In reply to comment #1) > > Add a comment here explaining why we don't use the more-concise OpenURI (which > would probably like a content-hint overload later?), and r=shaver. What would be even nice is having NS_OpenURI do a WARNING() that it's slow :)
tracking-fennec: ? → 2.0b5+
Attachment #510695 - Attachment is obsolete: true
Attachment #510801 - Flags: review+
Keywords: checkin-needed
Whiteboard: [has-patch]
This looked good on try; pushing to m-c: http://hg.mozilla.org/mozilla-central/rev/682d008059c6
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b12
looks like checkin-needed is not useful anymore? Set it back if I'm wrong.
Keywords: checkin-needed
Depends on: 1352684
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: