Defer Parsing of Javascript

Not sure why, but Google seems to recommend putting it in the <head> section. You’d have to check with Google whether there’s a specific reason for that, though. I usually put it at the bottom anyway, and haven’t seen a problem with doing so.

Like many people these days, most websites are fat, bloated and overweight. Does that mean you shouldn’t bother? Not at all. :slight_smile:

That is a good point. When attempting to optimize JavaScript for example, there are many cases where even if JavaScript was infinitely fast, taking 0 ms to run, that would not help speed up the time by much.

Performance evaluation should come first, so that you can figure out where the largest slowdowns are occurring, which by focusing on them will result in the biggest gains.

Well I noticed that they put their scripts in the <head> section and it detects that that is bad, where it should it be on the bottom and it is a little misleading because your taught put them on the the bottom and not the top and it gets confusing :expressionless:

I guess not…but in my companies case anything helps ha…

But for the website I work for optimizing Javascript made a big impact on the results of the pageinsights test, hence a bigger score. So I guess it depends?

It depends on what will gain you the most benefit, and performance evaluation is the most reliable way to figure out what is slowing you down the most.

1 Like

I’m of the belief that true professionals with no internal obstacles due to old, antiquated code should always be aggregating, gzipping, and reducing asset requests AS much as realistically possible. It does make a difference but when there is a old, antiquated mess built by someone who didn’t know what they were doing or CMS/Framework that promoted bad practices and made it difficult to do things right than yes you will need to weight benefits with the amount of time and risk involved in optimization tasks. However, if you’re stating from scratch this should all be a no brainer especially with tools like grunt and gulp available. It does make everything more complex but any optimization task worth doing typically does.

1 Like

In the head it would include anyone who visits the page long enough for the analytics code to record the visit but who don’t wait long enough for the actual content to load making for higher visitor counts.

2 Likes

Good point, @felgall. And given how many slow-loading pages I give up on all the time, there’s probably quite a significant difference in the stats!

1 Like

Thank You all great points.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.