Increase site load time while loading data in static website
<body> ... <section id="sponsors"></section> ... <script src="sponsors.js"></script> </body>
sponsors.js loads the data from
sponsors.json using a
$.get() and then uses the data to create a table.
My question is which of the following approach increases the site load time?
- Using the above approach keeping the data in a separate json file.
- Keeping the data in
sponsors.jsinstead of keeping in a separate json file
- Hard coding the table with the individual data
- Any other approach not listed above?
3 is the fastest approach because the data does not need to be rendered, however hard coding is not very useful.
2 is slightly faster as a seperate request does not need to be made.
1 is the slowest, however if you cached the json in a cookie it would not have to be downloaded every time. By using an expire on the cookie it would trigger it to be downloaded again.
20 Ways to Speed Up Your Website – and Improve Conversion by 7%, How to improve your website load time, offer a better user experience, and CDNs are typically used for static content or files that do need to be touched once on your system, which allows subsequent page loads to increase in speed. The Google website speed statistics I quoted at the beginning of this guide reveal that the average web page load times are 8-10 seconds, depending on the industry. You can beat that. You can make your site load in half that time with proper optimization, good hosting, and scaled images. It is not rocket surgery.
Well, the best approach in terms of performance is always the one that involves as few files as possible.
Inlining your JSON would certainly be best for performance, but then you're making a sacrifice in code readability and modularity. You're going to have to make a judgement for yourself on what the best solution is, by balancing ease of programming with performance.
Personally, I'd stick with what you got, because changing the JSON later won't be complicated at all - and the performance hit you'll take won't likely be noticeable, much less game breaking.
Keeping the data in an external JSON would increase the time to load the table, but would descrease the time needed to load the page itself. Instead hard coding the table will load the table instantly but it will also increase the time to load the page.
10 Ways to Make Your Website Load Faster, The following are some tips for decreasing your web page loading times. When using HTTP compression, all of your web page data is sent in a single smaller Browsers can only download two components per hostname at the same time. This, then, doesn't take advantage of browser caching and increases the size of UPDATE – We made a newer version of this for 2020: Average Page Load Times for 2020 With 2018 just around the corner it’s time to be aware of how your site performance compares to the standards of the new year. Each year the average size of a website goes up, but so does the …
10 Tips for Decreasing Web Page Load Times, The Venture Harbour site wasn't too bad with a page loading speed of 1.61 seconds, at Venture Harbour, including MaxCDN, Cloudwatch, Static DNA and Cloudflare. While researching our guide to the best web hosting, I setup response time use Xenu Link Sleuth, which is a great tool for crawling data from websites. Sometimes when I access my windows azure website, the initial response time is very slow. After the first page load the website is fast. Some background: The website is not that often visited at the moment. Further, I am using a keepalivecontroller to keep the website running and the website is running in shared mode.
How to Improve Your Page Load Speed by 70.39 , 3 is the fastest approach because the data does not need to be rendered, however hard coding is not very useful. 2 is slightly faster as a
Increase site load time while loading data in static website, How optimizing page load time on your website can help improve user being sent to the server and the browser receiving the first byte of data. Web page loading speed is a crucial part of a site's usability. You can use Expires headers for static components of the site and Cache-Control headers for dynamic ones.