ProgressTracker::RemoveObserver does unnecessary hashtable lookups

RESOLVED FIXED in Firefox 56

Status

()

Core
ImageLib
P3
normal
RESOLVED FIXED
a year ago
a year 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

a year ago
Created attachment 8881411 [details] [diff] [review]
Use Lookup instead of Get+Remove to avoid unnecessary hashtable lookups
Attachment #8881411 - Flags: review?(nfroyd)
Comment on attachment 8881411 [details] [diff] [review]
Use Lookup instead of Get+Remove to avoid unnecessary hashtable lookups

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

::: image/ProgressTracker.cpp
@@ +472,5 @@
>    // Remove the observer from the list.
>    bool removed = mObservers.Write([=](ObserverTable* aTable) {
> +    if (auto entry = aTable->Lookup(observer)) {
> +      entry.Remove();
> +      return true;

Another valid use case for Remove() having a useful return value.
Attachment #8881411 - Flags: review?(nfroyd) → review+

Comment 3

a year ago
Pushed by mpalmgren@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/1cccacc0f442
Use Lookup instead of Get+Remove to avoid unnecessary hashtable lookups.  r=froydnj

Comment 4

a year ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/1cccacc0f442
Status: NEW → RESOLVED
Last Resolved: a year 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.