The TOFFEE Project
The TOFFEE Project

Research :: Building my own CDN - Minify Script files - Update: 23-July-2016

Written by: Kiran Kankipati - Published: 23-Jul-2016


One of the suggestions Google PageSpeed Insights tool suggested for The TOFFEE Project website is to minify the css and java script files (as discussed in my earlier update on 22-July-2016. You can read the same HERE).

Minify Script files: When you read online about minification of your web script files, often they highlight file size savings and thus resulting faster download time and better website performance. This is true to an extent. But these days we get faster networks and the websites are already getting bulky loaded with lots of image files. So saving few kilobytes by minification of these script files sometimes hardly matter. But being myself a systems architect I can see there are other advantages in a systems point of view.

Assume users are accessing your website(s) via Mobile devices and mini-PC hardware platforms. In these cases the CPU and memory resources in these devices are limited. In that case the scripting language interpreters such as Javascript/CSS/HTML (existing within your browsers) will have less preprocessing work to do if the script files are minified. When these interpreters parse a text based script file it needs to skip comments and various white spaces. This causes unwanted CPU overhead. So minified script files are lot more interpreter parser optimized. In other words, if you minify php files, you server (such as your Apache web-server in your hosting site) processing overhead will reduce, if you minify Javascripts, CSS, HTML your client (Browser) processing overhead will reduce.

In the case of C/C++ programs, programmers compile and generate machine readable binary output in offline. This is a passive operation where a developer builds and publishes/releases his compiled binaries. But in the case of script files, the interpreters have to parse these files in real-time and this is a CPU bound operation in real-time. And hence it makes sense to minify the script files.

Here is my Joomla protostar template main css file. As you can see below this is neatly formatted and human readable. But for the reasons discussed above, this needs minification.
joomla original protostar_css template file

To minify the same, I can use various online tools. But there is a risk in using the same sometimes. Since there are various levels of minification one can do. Such as removal of comments, removal of white spaces and as well refinements in code so that it can produce the same browsing experience. Since this file is a very large file I decided to manually minify the same. And I am afraid using online tools as they may introduce any bugs into the same.

So I started manually minify the same in various stages. I can maintain several snapshots (versions of the script file) so that if something goes wrong I can safely roll back to a previous version which is working flawless.
joomla minify protostar_css template file

And here is the screenshot of the original Joomla protostar template css file which is around 7500 lines.
joomla original protostar_css template file number of lines

So I am sure minification of these script files will boost my run-time website performance. As I explained before I am not bothered about the file download time, but instead I want to optimize its real-time rendering performance in a browser. This is my next yet another baby step towards building my own private CDN Network.

Here is my live video log of the same:

VLOG - Building my own CDN for TOFFEE website - Minify Script files - Episode2



Suggested Topics:

Generic CDN
Grid Hosting vs CDN Hosting
26-Jul-2016
CDN Hosting
26-Jul-2016
Streaming CDN Types
21-Jul-2016
CDN Introduction - Content Delivery Networks or Content Distribution Networks
20-Jul-2016
Advantages of CDN - Content Delivery Networks or Content Distribution Networks
20-Jul-2016
How to check a website using CDN ?
19-Jul-2016
CDN Content Delivery Networks - Types
29-Jun-2016

Building my own CDN
Building my own CDN - Moving away from Joomla to non-Joomla website - Update: 01-Oct-2016
01-Oct-2016
Building my own CDN - choosing a web-hosting to deploy my CDN - Update: 28-July-2016
28-Jul-2016
Building my own CDN - Minify Script files - Update: 23-July-2016
23-Jul-2016
Building my own CDN - Google PageSpeed Insights - Update: 22-Jul-2016
22-Jul-2016

 

Recommended Topics:

Network Optimization in Big Data Analytics:









Hardware Compression and Decompression Accelerator Cards:


Demo - Internet optimization through TOFFEE-DataCenter:


Learn Linux Systems Software and Kernel Programming:



The TOFFEE Project - v6.31 :: Updated: 14-Dec-2017 :: © 2017 :: Author: Kiran Kankipati
Your IP: 54.90.207.75 :: Browser: CCBot/2.0 (http://commoncrawl.org/faq/)