jeudi 2 mars 2017

Will JS-Uglify make it load faster?

What I was trying to do is to make my ember app load faster, the index.html file looks like this

<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Jobber</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">

    

    <link rel="stylesheet" href="assets/vendor.css">
    <link rel="stylesheet" href="assets/custom.css">

    
  </head>
  <body>
    

    <script src="assets/vendor.js"></script>
    <script src="assets/custom.js"></script>

    
  </body>
</html>

The size of vendor.js and custom.js together before uglify is 11mb, after uglify from ember-cli is about 4mb.

Then I tried to profile it in chrome Timeline(5x CPU throttling) to see if there is a noticeable difference. And here is what I got, top 3 charts are summaries after being uglified, bottom 3 are without uglify.

Screen shot

My question is will uglify really make it load faster? The only difference I can tell is the time spent in category Other is less, the Scripting part is very close and sometimes even longer.

I did a closer look into the time segmentations, seems like the compile time have decreased a lot but in total there is no much difference, if it does save time, where is the time being saved?




Aucun commentaire:

Enregistrer un commentaire