Search code examples
htmloptimizationcomments

Do HTML Comments Increase the Load time of a webpage?


If I add a lot of comments to my site, will it increase the load time for a user that doesn't have a fast internet connection?


Solution

  • Comments do not have a negative impact on the loading time (the browser ignore it), only on the downloading time but is not significant.

    If you have problems with load times the are other factor you can improve:

    • Optimizing images
    • Bundle and minify javascript code in an unique file
    • Expiration headers (Specify cache in the browser)
    • Script loading in bottom of the html before body clousure tag
    • Avoid redirections
    • Enable compression
    • It is also important to analyze the server load with the active site (cpu, memory, databases)

    A good tool for analyze and optimization web pages is google pagespeed