Current time: 01-24-2021, 03:59 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Helping WPT not count a non dependent JS file towards page load times
01-19-2021, 02:31 AM
Post: #1
Helping WPT not count a non dependent JS file towards page load times
An HTML5 game that we're building for a client needs to have a Fully Loaded score from WPT of 5 seconds max. Our page currently loads a single JavaScript bundle and takes longer than that, so we're going to split the game up into two parts: Assets for later parts of the game that the player doesn't need at launch will be loaded asynchronously, so they can already use the main menu or even start the game quicker.

However, the two second rule seems to kick in here when WPT measures the Fully Loaded time. Unless we specifically wait a little over 2 seconds (2200 ms seems to do the trick), any way we load assets seems to count towards the initial page load time, since it's detected as network activity. Even via script tag marked as `async`.

My question: Under our scenario, is there any way we can structure our code to avoid this page load time inflation in the WPT figure?

I can see how WPT can't really tell that what is being loaded has no dependencies to the initial interactions of the game (page), so it has to do what it can to assume this counts towards the initial page load metric.

Delaying further asset loading for over 2 seconds is mostly fine, if we do this for content used by the later game levels. We would get some extra flexibility in how we structure things though if we could avoid that extra delay.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)