New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Embedding loading slow #13472
Comments
Since this is both a regression, and a brutal slowdown (19s for 8 cards is not ok) I'm bumping this to a P1 |
Thank you @flamber for such a detailed analysis! I followed up your track and bisected all the ~200 commits between v0.34 and v0.35. Finally, I managed to narrow it down to single commit, 09001d6, that started to cause the embedding speed regression. Looking at the front-end code difference between v0.34 and commit 09001d6 (and effectively, v0.35 or later), the JavaScript grows by approximately 280KB. Here is the breakdown: In v0.34:
In v0.35 (right after commit 09001d6):
The above size difference causes the trigger to fetch the JSON (via XHR) to happen at different times as well. Notionly, it is a bit later for v0.35. To demonstrate this, I captured the network waterfall diagram (see the attached HARs, can be displayed with e.g.Online HAR Viewer) for both v0.34 and v0.35. To further stress the front-end code, this was carried out under the "Fast 3G" network throttling simulation in Chrome Dev Tools. With v0.34, the fetch is initiated after 8.69 seconds. However, with v0.35, it happens almost a full second later, at 9.60 seconds. This delay contributes to the slow down of iframe rendering for this embedding use case. Note that this is just testing a single (embedded) iframe. With a few more, there will be a cascading effect, adding further to the overall slow experience. My next attemp is to figure out why this extra 280 KB of JavaScript code adds so much delay (~1 s) to the initial data fetch and if there is a way to workaround it. |
For completeness, here is the code inflation due to the said commit, restricted to
The bulk of it is concentrated inside
My next step is find out why this extra 45 KB code adds so much to the initial delay of the (embedding) app. |
Another quick update. I can now see an obvious place where the said commit introduces a new significant JavaScript code execution. Before the commit, an illustrative example of the call tree from the code execution flame chart, before DOMContentLoaded event (which happens at 550 ms): Chrome DevTools estimated the total blocking time to be ~167 ms. In the meantime, after the commit was introduced (look at that deep, nested call tree!): which contributed to a whopping (estimated) 730 ms blocking time. This also explains why DOMContentLoaded event fires after 1.12 seconds. Next step: navigate the flame chart, understand the breakdown of the slow down even more. |
I can now confirm that the slow-down is caused by Chevrotain's To reproduce:
As shown in the following screenshot, Next step: find a way to avoid this up-front expensive initialization. |
This is now fixed with PR #14133. |
Describe the bug
Loading an embedding is a lot slower on 0.35.0+, and when there's multiple embeds on a page, then it blocks loading for many seconds without showing any indication (spinner etc).
I'm not sure if this is caused by pure JS blockers, or if this is something in the connection handling (Jetty etc). I have tried to debug, but got lost. At least I have found when the problem started.
To Reproduce
SELECT 1
as "Q1",SELECT 2
as "Q2" etc.html
) and update all the embed URLsShow HTML code
Another way to "reproduce":
Simply go to the embed preview in 0.34.3, which will load the preview much faster than any newer versions.
Expected behavior
At least non-blocking behavior, so a spinner is shown. Preferably sub-1-second load time.
The text was updated successfully, but these errors were encountered: