Closed Bug 1372323 Opened 7 years ago Closed 7 years ago

Console::IncreaseCounter does unnecessary hashtable lookups

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: MatsPalmgren_bugz, Assigned: MatsPalmgren_bugz)

References

Details

(Keywords: perf)

Attachments

(1 file)

No description provided.
(This is another example where having a Remove method on EntryPtr would save us a lookup. I think using LookupForAdd in these cases is still preferable to Get+Put since the Remove is very rare.)
Attachment #8876860 - Flags: review?(nfroyd)
(Filed bug 1372333 about adding a Remove() method.)
Blocks: 1372333
Comment on attachment 8876860 [details] [diff] [review] Use LookupForAdd instead of Get+Put to avoid unnecessary hashtable lookups Review of attachment 8876860 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/console/Console.cpp @@ +2195,5 @@ > > aCountLabel = string; > > + const bool maxCountersReached = mCounterRegistry.Count() >= MAX_PAGE_COUNTERS; > + auto entry = mCounterRegistry.LookupForAdd(aCountLabel); Ew. I think this could be avoided by making EntryPtr a little more powerful, even beyond adding a Remove() method.
Attachment #8876860 - Flags: review?(nfroyd) → review+
Pushed by mpalmgren@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/eb36d574ec6e Use LookupForAdd instead of Get+Put to avoid unnecessary hashtable lookups. r=froydnj
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: