, 1 min read
Accelerating Page Load Times by Reducing Requests
In trying to decrease load times of this blog, I noticed that the prism.js library requires quite a number of requests to the unpkg-server. So I tried to combine all these requests into only two. The results are quite impressive.
I compared various measurements using tools.pingdom.com.
Old situation, C-80, 1.67s load time:
I now downloaded the prism.js JavaScript code in one single file and stored this file on my web-server. New situation has now improved quite significantly:
Number of requests went down from 33 to 9. Performance grade went from C-80 to A-93, load time is 947ms.
I deliberately took the US as reference, as many readers of this blog come from the US. Running the test from Frankfurt, Germany, the result is A-93 (as before) and 244ms load time:
This load time is very similar when I download this page locally in my own network. Below image is from developer-tools in Brave/Chrome:
This result is quite surprising at first, as prism.js is hosted on unpkg.com, which is self-described as "fast, global content delivery network". Apparently, hosting something on your own server can be way faster than on some CDN.