Perf: Defer widget-schema prefetch AJAX to requestIdleCallback - #3
Draft
collinversluis wants to merge 1 commit into
Draft
Perf: Defer widget-schema prefetch AJAX to requestIdleCallback#3collinversluis wants to merge 1 commit into
collinversluis wants to merge 1 commit into
Conversation
Phase 5 of the perf series.
requestWidgetsConfig fetches ~394 KB of widget control schemas for widget types
NOT used on the page (in-page widgets already have their schemas in the boot
config). Currently fires synchronously during initEditor, so the response
parse + 394 KB jQuery.extend(true,{},...) deep-merge into widgetsCache races
with initial canvas render on the main thread.
This defers the entire request body + send + response processing into
requestIdleCallback (with a 3s timeout safety net, and setTimeout(0) fallback
for browsers without rIC). The only thing waiting on it is the panel-loading
spinner via panel/state-ready — the canvas is interactive immediately.
Gated by the existing e_memoize_active_controls experiment.
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The widget-schema prefetch AJAX request fires synchronously during editor bootstrap, competing for the main thread with the initial render. Wrap it in
requestIdleCallback(withsetTimeoutfallback for Safari) so it runs after the editor is interactive.requestIdleCallbackImpact
Moves ~200-400ms of network + JSON parse cost off the critical render path. Editor becomes interactive faster; the prefetched data is still ready by the time the user opens a widget panel.
Test plan
Notes
Cherry-pick from
claude/great-mayer-klkFh. Conservative — only changes WHEN the request fires, not what it does.Generated by Claude Code