Performance
Analysis, Researtching
The premise into this casestudy, was can I find any issues with a website and see if I could make any recommendations that may improve the overall performance of the site.
I chose a Chinese site called myprotein.cn. No reason why it was chinese, Well ok, it was a smaller task asigned from the university. Still it was an interesting topic and the fact that the site is Chinese holds some interesting results later on.
The first thought I followed was where is the actual host server compared to the actual users. Following the geographical IP of the server it turns out the main domain is located in Liverpool or Cheshire (It depends on which lookup service you want to use). At the same time I ran some network tests using Google Chromes dev tools. Thats a lot of files in that website!
Good practice of using alternate domains to host various files in order to bypass the HTTP request limit. More domains, means more simultanious files downloaded. Only problem here though, was when testing at home in the UK, I was getting the same Content Delivery Networks for each file when testing in other parts of the world. When running a geographical lookup on the domains, they're located in Atlanta, Georgia in the USA. Just to give you an idea...
Ok, so maybe The Hut Group could use CDN's that keep copies of the site in various locations around the globe in order to speed up the delivery or at the very least, reduce the initial ping and travel times of the data.
The content itself then, as mentioned earlier the waterfall model from the network tab in Chrome highlighted a lot of files. It turns out that around half of those files are JavaScript! Again good practice is mostly observed through the use of minified files in order to reduce the file size as much as possible. A few exceptions did appear but these were 3rd party scripts. It may be worth while either getting the files and minifying it themselves or checking out if there is already a minified version of the file out there.
Images, For the most part the images are of an acceptable size. Depending on which tool you use I got the additional optimisation anywhere from around 170KiB to 550KiB (You know I had to Google what a KiB was too, it's ok). It doesn't sound like much but if your talking mobile devices, then half a MB is a reasonable amount of data to try and reduce. It could be easier though and even more effective with the use of "srcset" in the img tag. The srcset is a little bit like an array or a list of breakpoints with the relevant associated picture to display.
<img src="legacy.jpg" srcset="small.jpg 320w, medium.jpg 720w, large 1080w" alt="Alt information">
It should be that easy. As well as using the srcset attribute, reducing DOM elements was another issue, at almost 2000 DOM elements, a vast amount of white space for the browser to read and ignore, the HTML in general could be tuned up. Reducing whitespace is a fairly mute point from server performance, as the website utilises gzip compression which negates any benefit that might have. From a purely asthetical point of view, the total of 13,435 lines could be reduced to as low as around 2317 lines, while still keeping it beautifully styled and indented. If the server didn't include gzip, then simply removing empty lines just saved the user 67KB of data.
Still looking at the HTML, there are around 50 uses of the developers using instances of the <b> tags along side additional styling only tags. Using effective HTML5 methods, these two tags can be reduced to a single <mark> tag. This tag is then able to be styled correctly in the CSS as required. The additional use of incorrect tags (yes, we know it should really be <strong> tag for HTML5) could remove 50 redundant DOM elements. Reducing the amount from 1978 to 1931. This is just one instance, other discoveries include nesting <div> tags for styling purposes and even unordered lists with a single item in it.