Current time: 03-08-2021, 05:56 PM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help Interpreting Waterfall Results - Long Task
02-13-2021, 10:55 AM (This post was last modified: 02-15-2021 10:43 AM by BensTechLab.)
Post: #1
Question Help Interpreting Waterfall Results - Long Task
Hello Fellow Website Optimizers!

So I've been optimizing my website and think I have it pretty good. It gets a perfect rating on google pagespeed insights (lighthouse), gtmetrix.com and webpagetest.org. My only main weakness is TTFB as I'm currently self-hosting my site from home on a Synology NAS (protecting my origin IP with CloudFlare). I'll fix my TTFB soon when I move the hosting.

However, my webpagetest.org results show a long ~1.2 second delay between first contentful paint and "fully loaded".

I'm using the super popular "lazysizes" JS library to lazy load images on the site. The last 2 requests you see are lazy loaded images. However why such a long delay? It seems the browser main thread is mostly idle. Bandwidth is 0. Cpu utilization low-ish.

What does the long green bar on the bottom right of this waterfall mean?

[Image: rjpZ0Jil.png]

If my post helps you, click the little "user +" icon on the lower left to give me a rep!
Find all posts by this user
Quote this message in a reply
02-15-2021, 10:47 AM
Post: #2
RE: Help Interpreting Waterfall Results - Long Task
Ok, while waiting for my post to be moderated, I actually solved my problem (or at least understand it).

The lazysizes JS deferred image loader has a weird "feature" where it insert a +1 second delay if your page onload event is faster than 1 second.

Excerpt from lazysizes source code:
Code:
var onload = function() {
    if (isCompleted) {
        return;
    }
    if (Date.now() - started < 999) {
        setTimeout(onload, 999);
        return;
    }


    isCompleted = true;

    lazySizesCfg.loadMode = 3;

    throttledCheckElements();

    addEventListener('scroll', altLoadmodeScrollListner, true);
};

If my post helps you, click the little "user +" icon on the lower left to give me a rep!
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


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