tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 33e22b3feba219bc1c065fb086c361c738fcc7be
parent 6b0ded1484eac226c37a4fe456ab94110aca3f34
Author: Markus Stange <mstange.moz@gmail.com>
Date:   Wed, 12 Nov 2025 15:43:52 +0000

Bug 1999322 - Give DelayedInit work a shorter budget. r=geckoview-reviewers,ohall

[`DelayedInit`](https://searchfox.org/firefox-main/rev/ced72179decc0fcffcbf4f4540ff4bcafbfb182e/mobile/shared/modules/geckoview/DelayedInit.sys.mjs) is a GeckoView module which is used for running asynchronous initialization tasks. It runs the tasks via `ChromeUtils.idleDispatch`, which roughly means "once the event loop has run out of work to do", and this occurs during applink startup before the page has finished loading. Due to bug 1956964 this means that those initialization tasks can delay the page load, so we should minimize the time which the main thread is blocked for.

Before this patch, we were coalesce work into 50ms chunks.

In newssite-applink startup profiles from CI we can see that these IdleDispatch runnables were taking between 30ms and 50ms before this patch:
https://share.firefox.dev/3LuHQqI (42.1ms IdleDispatch runnable)
https://share.firefox.dev/4hXAJ6o (34.0ms IdleDispatch runnable)

With the chunk time reduced to 5ms, we get these profiles:
https://share.firefox.dev/4qPjvvO (longest IdleDispatch runnable took 14.5ms)
https://share.firefox.dev/3LuNU2q (longest IdleDispatch runnable took 17.6ms)

Differential Revision: https://phabricator.services.mozilla.com/D272039

Diffstat:
Mmobile/shared/modules/geckoview/DelayedInit.sys.mjs | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mobile/shared/modules/geckoview/DelayedInit.sys.mjs b/mobile/shared/modules/geckoview/DelayedInit.sys.mjs @@ -49,7 +49,7 @@ export var DelayedInit = { // Maximum duration for each idling period. Pending inits are run until this // duration is exceeded; then we wait for next idling period. -const MAX_IDLE_RUN_MS = 50; +const MAX_IDLE_RUN_MS = 5; var Impl = { pendingInits: [],