Console::StartTimer/StopTimer does unnecessary hashtable lookups

RESOLVED FIXED in Firefox 56

Status

()

Core
DOM
P2
normal
RESOLVED FIXED
2 months ago
2 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

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

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

::: dom/console/Console.cpp
@@ +2087,5 @@
> +  mTimerRegistry.LookupRemoveIf(key,
> +    [&found, &entry] (const DOMHighResTimeStamp& aValue) {
> +      entry = aValue;
> +      found = true;
> +      return true;  // remove it

Maybe we should change this to some sort of eRemove/eKeep constant so that we don't have to insert these kind of constants.
Attachment #8876775 - Flags: review?(nfroyd) → review+

Comment 3

2 months ago
Pushed by mpalmgren@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/40a933ae0d2f
Use LookupForAdd instead of Get+Put, and LookupRemoveIf instead of Get+Remove, to avoid unnecessary hashtable lookups.  r=froydnj
https://hg.mozilla.org/mozilla-central/rev/40a933ae0d2f
Status: NEW → RESOLVED
Last Resolved: 2 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.