Closed Bug 1361747 Opened 3 years ago Closed 3 years ago

Avoid a double hashtable lookup for insertions in nsFrameMessageManager::AddMessageListener and nsFrameMessageManager::AddWeakMessageListener

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: ehsan, Assigned: ehsan)

Details

Attachments

(1 file, 1 obsolete file)

We can use the API added in bug 1359848 to be a bit smarter here.
Attachment #8864179 - Flags: review?(michael) → review+
Hmm...

So what Nathan asked me to do in bug 1361744 makes this patch *really* difficult to write, since here we need to deref the result of LookupForAdd both in the else branch and after the if branch, and there is no single good place to deref the EntryPtr and assign its return value to a return value.  So I'd either have to do that both in the else branch and after the if, or convert the -> operators to |(*listeners).Length()| and the like.  None of these options seem all that good.

I think I'll have to wait for the OrInsert() idea from bug 1361745.  I now wonder if Nathan's suggestion in bug 1361744 was a good one, but this doesn't seem worthy of a long debate. :/
Attachment #8864179 - Attachment is obsolete: true
Attachment #8865075 - Flags: review?(michael) → review+
Pushed by eakhgari@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/5fa6bc617e2f
Avoid a double hashtable lookup for insertions in nsFrameMessageManager::AddMessageListener and nsFrameMessageManager::AddWeakMessageListener; r=mystor
https://hg.mozilla.org/mozilla-central/rev/5fa6bc617e2f
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.