I’m trying to speed up the load time on my site. Google Developer Tools says my main HTML/TEXT page takes 2.18 seconds to load (Waiting TTFB). I assume this has something to do with inefficient PHP/MySQL scripts.
However, I use the following code to see how long the script loads:
$start_time = microtime(true); // very first line
echo “This page was generated in “.(microtime(true) - $start_time).” seconds.”; // very last line
Apparently this results in a page loading time of 0.38 seconds.
Although this is wrong because the page really does load up in 2-3 seconds as Google Developer Tools indicated.
Can anyone explain this behavior? Any tips on speeding this up?