nsDocument::GetOrCreateRadioGroup does unnecessary hashtable lookups

RESOLVED FIXED in Firefox 56

Status

()

Core
DOM: Core & HTML
P2
normal
RESOLVED FIXED
5 months ago
5 months ago

People

(Reporter: mats, Assigned: mats)

Tracking

({perf})

Trunk
mozilla56
Points:
---

Firefox Tracking Flags

(firefox56 fixed)

Details

Attachments

(1 attachment)

Comment hidden (empty)
(Assignee)

Comment 1

5 months ago
Created attachment 8876767 [details] [diff] [review]
Use LookupForAdd instead of Get+Put to avoid unnecessary hashtable lookups
Attachment #8876767 - Flags: review?(nfroyd)
Comment on attachment 8876767 [details] [diff] [review]
Use LookupForAdd instead of Get+Put to avoid unnecessary hashtable lookups

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

::: dom/base/nsDocument.cpp
@@ +8186,4 @@
>  nsDocument::GetOrCreateRadioGroup(const nsAString& aName)
>  {
> +  return mRadioGroups.LookupForAdd(aName).OrInsert(
> +    [] () { return new nsRadioGroupStruct(); });

The smart pointer management + implicit conversions here makes my head hurt, but I don't think there's anything to be done about that.
Attachment #8876767 - Flags: review?(nfroyd) → review+

Comment 3

5 months ago
Pushed by mpalmgren@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/59ea5719988e
Use LookupForAdd instead of Get+Put to avoid unnecessary hashtable lookups.  r=froydnj
https://hg.mozilla.org/mozilla-central/rev/59ea5719988e
Status: NEW → RESOLVED
Last Resolved: 5 months ago
status-firefox56: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.