Closed
Bug 1372356
Opened 7 years ago
Closed 7 years ago
RuntimeService::RegisterWorker/UnregisterWorker does unnecessary hashtable lookups
Categories
(Core :: DOM: Workers, enhancement, P2)
Core
DOM: Workers
Tracking
()
RESOLVED
FIXED
mozilla56
Tracking | Status | |
---|---|---|
firefox56 | --- | fixed |
People
(Reporter: MatsPalmgren_bugz, Assigned: MatsPalmgren_bugz)
Details
(Keywords: perf)
Attachments
(2 files)
1.35 KB,
patch
|
froydnj
:
review+
|
Details | Diff | Splinter Review |
2.24 KB,
patch
|
froydnj
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•7 years ago
|
||
Attachment #8876882 -
Flags: review?(nfroyd)
Assignee | ||
Updated•7 years ago
|
Summary: RuntimeService::RegisterWorker does unnecessary hashtable lookups → RuntimeService::RegisterWorker/UnregisterWorker does unnecessary hashtable lookups
Assignee | ||
Comment 2•7 years ago
|
||
Attachment #8876886 -
Flags: review?(nfroyd)
Comment 3•7 years ago
|
||
Comment on attachment 8876886 [details] [diff] [review] Use mWindowMap.LookupForAdd instead of Get+Put, and LookupRemoveIf instead of Get+Remove, to avoid unnecessary hashtable lookups Review of attachment 8876886 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/workers/RuntimeService.cpp @@ +1879,5 @@ > + DebugOnly<bool> found = false; > + mWindowMap.LookupRemoveIf(window, > + [&aWorkerPrivate, &found] (nsTArray<WorkerPrivate*>* aWindowArray) { > + MOZ_ALWAYS_TRUE(aWindowArray->RemoveElement(aWorkerPrivate)); > + found = true; We are using this |found| pattern quite often with this function, maybe we should find some way of integrating it into the function itself?
Attachment #8876886 -
Flags: review?(nfroyd) → review+
Updated•7 years ago
|
Attachment #8876882 -
Flags: review?(nfroyd) → review+
Pushed by mpalmgren@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/3ad2c67c6669 Use LookupForAdd instead of Get+Put to avoid unnecessary hashtable lookups. r=froydnj https://hg.mozilla.org/integration/mozilla-inbound/rev/dfd1cb941248 part 2 - Use mWindowMap.LookupForAdd instead of Get+Put, and LookupRemoveIf instead of Get+Remove, to avoid unnecessary hashtable lookups. r=froydnj
Comment 5•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/3ad2c67c6669 https://hg.mozilla.org/mozilla-central/rev/dfd1cb941248
Status: NEW → RESOLVED
Closed: 7 years 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.
Description
•