AiTab: [FE] Do not await font to load page contents
Categories
(Core :: Machine Learning: General, defect, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox160 | --- | fixed |
People
(Reporter: mlucks, Assigned: mlucks)
References
(Blocks 1 open bug)
Details
(Whiteboard: [aiaug])
Attachments
(1 external file)
Currently the custom font for Smart Page hinders first load TTFB by around 700ms. Most of this time is waiting on the Remote Settings server to respond. 2 calls are made to connect to RS before the font itself starts to download. Since these 2 preliminary calls are inexpensive, barely 1kb each, we can split those two off, and "open the tunnel" to RS as soon as a user opens a Smart Window. By doing this, the TTFB on a Smart Page dramatically reduces (the font file itself is 66kb and takes around 70-80ms to download)
Before Fix (Profile 1): first load, first contentful paint at 741ms
Before Fix (Profile 2): second load, first contentful paint at 69ms
We prototyped a fix and received these results from the profile:
After Fix: first load, first contentful paint at 58ms
This task is to take that prototype and implement it into the codebase
Updated•1 month ago
|
Comment 1•1 month ago
|
||
| frontend-triage | ||
AITabHeadingFont.sys.mjs only starts work from AITabParent.actorCreated, and #handleGetPage waits for the font before it returns the page (AITabParent.sys.mjs, #136). On a fresh profile, ai-window-aitab has no JSON dump, so client.get() has to pull the startup bundle or sync from the server first. That includes the server-info fetch behind Utils.baseAttachmentsURL(), and it all happens before the attachment download starts.
Fix: Export a prewarmHeadingFont() that calls client.get({ filters: { name: HEADING_FONT_RECORD_NAME } }) without downloading the attachment, swallows errors, and returns early unless browser.smartwindow.aitab.enabled is set. Call it fire-and-forget next to the two _startSchedulers() calls in AIWindow.sys.mjs: the active-window branch of init() and the isTogglingToAIWindow branch of toggleAIWindow() at #1215. This follows the getAllModelsData() warm-up at #220. Then extend browser_aitab_heading_font.js to check that the prewarm fills the local records without fetching the font.
Suggested severity: S3. Smart Page's first paint on a cold profile is about 700ms late in a pref-gated feature, and later loads are fast once Remote Settings has synced.
If you'd like to provide feedback on this comment, please use the 👍 or 👎 reaction.
If you want to categorize your feedback you can add one of the following tags: ai-triage-{wrong-file, wrong-cause, hallucination, out-of-scope, not-a-bug, wrong-fix, shallow-fix, wrong-severity}.
Needinfo hackbot@mozilla.tld to have a patch generated for this bug, include any questions or directions as needed in your comment.
Weve changed directions, instead, just let the font come when it comes, and accept that first loads will experience a font flash on loading. If there comes a time when we need remote settings more globally, or find another path to prevent the flash, we can address at that time
Updated•1 month ago
|
Updated•1 month ago
|
Comment 5•1 month ago
|
||
| bugherder | ||
Updated•1 month ago
|
Description
•