Bug 258808 - Initialising many a/v players on Safari is done very inefficiently
Summary: Initialising many a/v players on Safari is done very inefficiently
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Safari 16
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-07-03 07:01 PDT by Derk-Jan Hartman
Modified: 2023-07-05 08:02 PDT (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Derk-Jan Hartman 2023-07-03 07:01:30 PDT
This was initially noticed on https://en.wikivoyage.org/wiki/Portuguese_phrasebook with Safari 16.5.1

This page has 440 audio players. Even if we disable all JS for this page, this page is incredibly slow to load in Safari (some 20 or so seconds). When loading the same page in FF or Chrome it loads within 3 seconds (even with JS enabled). I have pinpointed this to the initialisation of the audio players on this page.

Analysing the behaviour, it seems that the page uses 1 single callback to initialise the UI for all the players on the page but does so dynamically based on the available space and it seems to do some sort x ** n measuring.

I've filed this under Page loading instead of media, because of the serious effect on the loading phase.
Comment 1 Alexey Proskuryakov 2023-07-03 15:23:02 PDT
Yes, this wikipedia page is very slow to load and to scroll.

It spends half of the time in layout trying to figure out if layers want to composite, and another half in JavaScript code under ensureMediaControls(), notably in a callout to WebCore::jsMediaControlsHostPrototypeFunction_base64StringForIconNameAndType().

I think that I've seen an earlier bug about slowness loading a page with many audio elements, but I cannot find it now.
Comment 2 Radar WebKit Bug Importer 2023-07-05 08:02:10 PDT
<rdar://problem/111786613>