[HTML Report] Reduce report load time by deferring collapsed section parsing#11495
Open
hotbees wants to merge 4 commits into
Open
[HTML Report] Reduce report load time by deferring collapsed section parsing#11495hotbees wants to merge 4 commits into
hotbees wants to merge 4 commits into
Conversation
render the main raid DPS chart early so that it doesn't take forever to appear on large reports. motivated by full raid sim stacks like are published on simulationcraft.org
the section-open / grouped-first / grouped-last classes that separate and round the report's sections were only applied by `validate_section()` on document.ready, causing a noticable layout shift when they snap apart on larger (longer-loading) reports. instead, we include them directly on the sections we know will be present: section-open for the default-open sections (raid summary and profile sets), grouped-first for hotfixes and grouped-last for the table of contents. this makes the styling and layout mostly correct before document.ready, improving the feel on larger reports.
A significant portion of page load time on larger reports is spent parsing HTML and building the DOM. By enclosiong heavier per-actor subsections (Abilities, Buffs, Procs/Uptimes/Benefits, Resources, Action Priority List, Statistics & Data Analysis, Stats, Gear, Profile, Talents (multi-player only), Parsed Player Effects) in `<script type="text/x-deferred-html">` blocks, the browser will skip parsing these sections, and we can later inject this unparsed HTML into the DOM with a bit of JS once the user actually opens the section. This gives us a report which is interactive much faster by avoiding having the browser do heavy parsing work on sections that may never be opened.
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.
HTML reports are real heavy on HTML. A significant portion of page load time on reports (very noticably on larger ones) is spent parsing HTML and building the DOM. This can result in larger reports like the full-raid sim stack taking several seconds (perhaps an understatement depending on hardware) to fully load and be usable.
Defer section parsing
By wrapping heavy per-actor subsections in
<script type="text/x-deferred-html">blocks, we can have the browser skip parsing these sections upfront, and we can instead later inject this unparsed HTML into the DOM with a bit of JS once the section is expanded.There's still a lot going on in an HTML report, so this doesn't completely eliminate the problem, but it does give us a report with a much faster time-to-interactive by avoiding having the browser do heavy parsing and DOM construction inside actor sections that may never be opened.
Profiling
MID1_Raid.simcreport, average of 3 runs each (Chrome DevTools traces):Where Time to Interactive is when the main thread stops being tied up by long tasks, i.e. when interactions respond without lag (~1.9 s sooner here).
Measurements were done in a Chrome incognito mode window without any extensions loaded. Certain extensions can compound on the load time and make the differences even more stark. For example, doing the same measurements (single run) in my regular browser window gives a DCL before/after of 9,926 ms / 990 ms (10x) and TTI 16,897 ms / 2,266 ms (7.5x).
Deferred sections: Abilities, Buffs, Procs/Uptimes/Benefits, Resources, Action Priority List, Statistics & Data Analysis, Stats, Gear, Profile, Talents (multi-actor reports only), Parsed Player Effects - each builds on first expand.
Other low-hanging fruit
Additionally, this addresses a couple low-hanging fruit which improve the feel of (esp. larger) reports as the page loads:
Emit the raid dps chart in HTML generation. Currently, the raid dps chart isn't loaded until document ready. This is often the star of the show on large sim stacks and having it visible ASAP rather than deferring it is an easy W for usability.
Emit the
section-open/grouped-first/grouped-lastclasses in HTML on impactful sections:section-openfor the default-open sections (raid summary and profile sets). These are already marked by"toggle open"classes, but thesection-openclass which visually separates a given section from the rest isn't applied untilvalidate_section()runs at document ready, causing a slightly jarring layout shift as the sections snap apart.grouped-firstfor hotfixes andgrouped-lastfor the table of contents apply the corner rounding to the separated group above the raid summary. Fairly minor but this styling also currently gets deferred until document ready and this specific group is visible in the top of the page, so it makes sense to apply them early as a mostly-correct first approximation.For consistency, I also put
section-openon the main player for single actor reports since it's also open by default and there's a noticable snap apart there.