Closed Bug 1503620 Opened 6 years ago Closed 2 years ago

Very high CPU use on Alphaprep FAQs page due to 75 (hidden) youtube embeds

Categories

(Web Compatibility :: Site Reports, defect, P3)

Tracking

(firefox65 affected, firefox95 affected, firefox102 affected)

RESOLVED WORKSFORME
Tracking Status
firefox65 --- affected
firefox95 --- affected
firefox102 --- affected

People

(Reporter: yoasif, Unassigned)

References

(Depends on 1 open bug, )

Details

(Keywords: nightly-community, perf, webcompat:site-wait)

As seen on reddit: https://www.reddit.com/r/firefox/comments/9sz8be/firefox_640b5_extreme_cpu_and_memory_usage_on/ STR: 1. Navigate to https://alphaprep.net/faqs What happens: Massive CPU use, lots of jank, "this page is slowing down your browser", fans start going off. Expected result: Aside from the crazy tracking going on in this page, this is a pretty static page. Hopefully not have crazy CPU use here. FWIW, Chrome is better on this page, but not hugely so -- this is a bad page. Profile here: http://bit.ly/2EU08io - I loaded the page and opened the first FAQ entry.
Has STR: --- → yes
Thanks for the report! I don't think this is layout-related. The profile seems to show that most of the time is spent parsing javascript, I think? (16 seconds of time spent in js::frontend::GeneralParser::statementList for example).
Component: Layout → JavaScript Engine
Whiteboard: [qf]
The page actually has 75 <iframe> elements pointing at youtube, and we're spending time parsing JavaScript for all of those videos. :( They're not painted at all, but they do exist and we still have to load them and run their JavaScript, because it could have side effects in the parent site (though it probably doesn't in this case). You can see these in the page source if you scroll all the way to the bottom and search for the string "youtube". It seems to be a bunch of SEO junk. e.g. > I am using this site to prep me for my exam and I am loving it.Hope this helps!<br /> > <iframe width="560" height="315" src="https://www.youtube.com/embed/Fp6yqEw6ZuI" frameborder="0"></iframe> The videos (at least that one) seem to be from AlphaPrep themselves. So this is their own SEO stuff -- it doesn't seem that they got hacked or anything. But they're likely unaware of the performance implications of dumping 75 of these onto a single page. :) Reclassifying as Tech Evangelism --- the right fix here is for AlphaPrep to remove all of these videos (or at least limit themselves on how many they dump into a single page).
Component: JavaScript Engine → Desktop
Product: Core → Tech Evangelism
Whiteboard: [qf] → [qf-]
I asked the reporter on Reddit to see about getting in touch with the company, and I tweeted at them with a suggestion in case that helps: https://twitter.com/CodingExon/status/1058099588458921985 Note: each of the iframes seems to be downloading & parsing https://www.youtube.com/yts/jsbin/player-vflVce_C4/en_US/base.js , which is 1.3 MB of JavaScript. I wonder if we could be doing something better about caching the results of this operation so that we're not duplicating work so much here...
(Ah, that's bug 1393977. So to the extent that there's something we can do to help here on the Firefox side, it'd be to fix bug 1393977.)
Depends on: 1393977
Summary: Very high CPU use on Alphaprep FAQs page → Very high CPU use on Alphaprep FAQs page due to 75 (hidden) youtube embeds
Product: Tech Evangelism → Web Compatibility
Priority: -- → P3

I did not experience high CPU when navigating to the page.

Tested with:
Browser / Version: Firefox Nightly 87.0a1 (2021-02-01)
Operating System: Windows 10 Pro

Asif can you still reproduce it on your side?

Flags: needinfo?(yoasif)

Needs Triage.

Flags: needinfo?(raul.bucata)
Flags: needinfo?(oana.arbuzov)

I was not able to reproduce the issue. The page did not present any performance issues regarding resource usage of the device

Tested with:

Browser / Version: Firefox Nightly 92.0a1 (2021-07-13) (64-bit)
Operating System: Windows 10 PRO x64

Suggestion: Try clearing cache/data/cookies, disable addons and Ad-blocker (if available), or use a clean profile, and check again? If there are any changes made to the default settings of the browser (e.g. in about: config) please revert to the default settings and try again. Also, have the required cookies been accepted for this page?

Flags: needinfo?(raul.bucata)
Flags: needinfo?(oana.arbuzov)

I can still see quite-high CPU usage on this site (~100% of one CPU for at least 30 seconds after loading the site).

A profile shows a whole bunch of youtube embedded videos being downloaded and a bunch of JS-engine time relating to that:
https://share.firefox.dev/3id5pSp

So I think this is unchanged (still a problem).

Having said that, comment 0 notes that Chrome is also-bad on this page, so there may not be too much of a discrepancy between us and them at this point; this is just kind of a pathological site. Also, despite the high CPU usage, I don't notice any jank / interaction problems (though maybe that's just because I have a fast computer).

In any case, bug 1393977 would presumably still save some of our CPU time here.

Flags: needinfo?(yoasif)

https://share.firefox.dev/3w4h1xD
YouTube videos are still loaded.

See Also: → 1393977

I sent them a message.

Performance Impact: --- → -
Whiteboard: [qf-]

I've managed to reproduce the issue on my side after scrolling the page up/down a few times, but this behavior is random.
The YouTube iframes are still present.

Tested with:
Browser / Version: Firefox Nightly 102.0a1 (2022-05-18)
Operating System: Windows 10 Pro

Performance Impact: - → ---
Severity: normal → S3

I was not able to reproduce the issue: https://prnt.sc/bZbGxfVrdCsX

Daniel, is the issue still reproducible for you?

Tested with:

Browser / Version: Firefox Nightly 110.0a1 (2023-01-16) (64-bit)
Operating System: Windows 10 PRO x64

Flags: needinfo?(dholbert)

I can't reproduce anymore either. I think the site has changed to no longer do the silly thing they were doing. In particular:

(In reply to Daniel Holbert [:dholbert] from comment #2)

The page actually has 75 <iframe> elements pointing at youtube, and we're
spending time parsing JavaScript for all of those videos. :(

This^ seems to have changed. The site now only has 2 <iframes>, both associated with the floating "chat" bubble at the bottom right corner of the page.

Status: NEW → RESOLVED
Closed: 2 years ago
Flags: needinfo?(dholbert)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.