Repository navigation
Conversation
The comparison page laid out and drew both control flow graphs on load, which holds the main thread for seconds on a large pair, for graphs that start below the first screen at phone and desktop sizes alike. They are now drawn once any part of them enters the upper three quarters of the window, or a control above them is used by pointer or keyboard. Without IntersectionObserver they are drawn on load, as before. Show Loops, Show Cycles and the loop-boundary and tooltip checkboxes were bound by showGraph(), so a click before the first graph was drawn did nothing, or left a checkbox saying the opposite of what the graphs showed. With the drawing deferred that is any click before scrolling, so bindDisplayControls() binds them when the page loads; each panel picks up their state as it draws, as it already did for a panel that finished after the other. The Combined view is offered once both graphs are drawn. Pressing it before then starts the drawing, and is now remembered and acted on once the option is there, unless Side by side is pressed after it.
This was referenced Oct 21, 2026
Open
Open
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.
The function comparison page (
/data/matches/function/<a>/<b>) lays out and draws both control flow graphs as soon as it loads. On a large pair that holds the main thread for seconds. Meanwhile the graphs start at the bottom edge of the first screen on desktop (927 px down in a 940 px window) and below it on a phone. On 549/2356, 237 and 240 blocks, Lighthouse counts 1.8 s of blocking time on desktop on master, and 0 with this branch. This draws the graphs once they come into view, or once a control above them is used.Change.
result_compare_function_vs.html:53-90:window.onloadno longer calls the two loaders.drawGraphs()(:66) calls them once. It runs when any part of#xcfg_containerenters the upper three quarters of the window, through anIntersectionObserverwithrootMargin: "0px 0px -25% 0px".pointerdown,focusinorkeydowninside#xcfg_top, the controls above the graphs. Using one is a request for the graphs too.IntersectionObserver, the graphs are drawn on load, as before.main_duo.js:3791,bindDisplayControls(), binds Show Loops, Show Cycles, Show Loop Boundaries and Enable Tooltip.showGraph()used to bind them, so a click made before the first graph was drawn did nothing, or left a checkbox saying the opposite of what the graphs showed. On master that window was the first seconds of the load; here it would be all the time before scrolling.bindDisplayControls()at load.reapplyHighlight()runs aftershowGraph()(main_duo.js:1361,:1403);setLoopBoundaryVisibility()runs at the end ofrenderLoopBoundaries()(:3779);isTooltipEnabled.function_compare.js:onGraphShown()(:95) offers Combined only once both graphs are drawn.:51) and acted on once the option is there (:109), unless Side by side is pressed after it.pointerdownof a press, no click, so that is what the label listens for.What this costs: the freeze moves from the load to the first scroll down to the graphs, and the panes are blank until the graphs are drawn. Master never showed the page's "Loading" text either, as nothing un-hides
#loading_aand#loading_b. A Web Worker for the layout, as #292 does for the single function page, would remove the freeze itself. Nothing draws the graphs for printing, so printing the page before scrolling to them prints empty panes.Verification. On the testbed, master (6564602) and this branch (0e6aa5f) ran as side instances against the live backend, logged in as analyst1. Apart from the logins and the
findLoopsPOST the page itself sends, every request was a GET.Lighthouse 12.8.2 on 549/2356, three runs a side, the two sides in turn. Performance is given for each run; the rest are means.
base.htmlhas no viewport meta tag, so a phone lays the page out 980 px wide and zoomed out. The graphs are then in view at load, and the branch fetches them at load too: both sides fetched the two graphs in every mobile run. Establish UI/UX parity and design consistency across views #253 adds the tag.In Chromium, master against the branch:
#function_xcfgURL and the "Go to the control flow graphs" button at the top both end with the graphs drawn and their heading at the top of the window. That is scrollY 792 at 1440x900 and 772 at 412x823, the same on both sides, and the page height is the same too.Tests. In
tests/testFunctionVsBrowser.py:test_the_graphs_are_drawn_when_they_come_into_view[mobile|desktop]: at Lighthouse's two sizes, nothing is fetched or drawn after load, until the graphs are scrolled to.test_using_a_control_above_the_graphs_draws_them[click|focus]: with an observer that never reports, a click on Reset view or focus on Sync graphs draws them, without a page error.test_the_display_controls_used_before_the_graphs_are_drawn_hold_once_they_are[#showLoops-Hide Loops|#showCycles-Hide Cycles]: the graphs' answers are held while a highlight button, the boundary checkbox and the tooltip checkbox are used. Once drawn:test_combined_pressed_before_the_graphs_are_drawn_is_shown_once_they_are[combined|taken-back].test_without_intersection_observer_the_graphs_are_drawn_on_load.comparison_pageandpage_with_a_dangerous_api_name).bindDisplayControls();rootMarginof0px, which draws at load at the desktop size.test_without_intersection_observer_the_graphs_are_drawn_on_load, as master always draws on load.ruff check .is clean.Relation to open PRs. A trial merge (
git merge-tree) with each open PR head is clean. Five open PRs change this branch's files in their own commits: #160, #245, #264, #269 and #304. #304 is stacked on #245, and #266 on #264. Each was merged locally with this branch, andtests/testFunctionVsBrowser.pywas run on the merge:open_comparison()and wait for drawn graphs. With this branch the graphs wait to come into view, so five of them time out. One line resolves it:scroll_to_the_graphs(page)after thegotoinopen_comparison(). With it, the merge passes all 33 tests.