Closed Bug 1948535 Opened 1 year ago Closed 1 year ago

Testcase generating N serviceWorkers is 6x slower than Chrome. With 10x the service workers, Nightly is 45x slower

Categories

(Core :: DOM: Service Workers, enhancement)

enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1950873

People

(Reporter: mayankleoboy1, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Attached file ServiceWorker.HTML

Open attached testcase.
Enter a number and press enter.

50K

500K

This is an artificial testcase. Maybe this suggests some hotspots in our code? As always, feel free to close as INVALID/WONTFIX.

removed teh try-catch thingy. No difference in relative difference. I have the laptop on battery now so the numbers are slightly higher.

50k
Chrome: https://share.firefox.dev/3D5UzvU (300ms)
Nightly: https://share.firefox.dev/3X2Cg1J (2.2s)

Can repro on a build from Jan2022, so not a new regression.

IIUC the test is not about (service) workers being slow, but mostly about promise rejections being potentially very slow if we have many of them. The test uses a script that does not exist on worker creation, which causes us to reject the promise (there seems to be some overhead inside mozilla::dom::ServiceWorkerScopeAndScriptAreValid until we understand that) which then makes them pile up and most likely cause some quadratic runtime inside JSRuntime::removeUnhandledRejectedPromise.

I assume one could rewrite the test, just creating a promise that rejects itself immediately to isolate better that specific case. I have no idea if that indicates some problem that might go beyond this very ill edge case. For example if we resolve a huge amount of promises instead (which could happen more likely in the wild?).

(In reply to Jens Stutte [:jstutte] from comment #3)

IIUC the test is not about (service) workers being slow, but mostly about promise rejections being potentially very slow if we have many of them. The test uses a script that does not exist on worker creation, which causes us to reject the promise (there seems to be some overhead inside mozilla::dom::ServiceWorkerScopeAndScriptAreValid until we understand that) which then makes them pile up and most likely cause some quadratic runtime inside JSRuntime::removeUnhandledRejectedPromise.

Based on this, I will dupe it to Bug 1950873. But please undupe if you disagree!

Status: NEW → RESOLVED
Closed: 1 year ago
Duplicate of bug: 1950873
Resolution: --- → DUPLICATE
Blocks: 1980560
See Also: 1943230
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: