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.
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.
<rdar://problem/111786613>