Created
May 3, 2013 12:47
-
-
Save Amatewasu/5508910 to your computer and use it in GitHub Desktop.
Un petit script pour comparer le taille des sorties d'uglifyJS2. Dans le premier cas on donne des scripts déjà minifiés et dans l'autre des "versions de développements".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var UglifyJS = require("uglify-js"); | |
var time = Date.now(); | |
var compressed = UglifyJS.minify(["jquery-1.9.1.min.js", "raphael-min.js", "reqwest.min.js", "string.min.js", "humane.min.js", "underscore-min.js", "backbone-min.js", "angular.min.js", "three.min.js"]) | |
compressedLength = compressed.code.length; | |
var uncompressed = UglifyJS.minify(["jquery-1.9.1.js", "raphael.js", "reqwest.js", "string.js", "humane.js", "underscore.js", "backbone.js", "angular.js", "three.js"]); | |
uncompressedLength = uncompressed.code.length; | |
var deltaTime = ((Date.now() - time) / 1000).toFixed(1); | |
console.log("Compressed:", compressedLength, "/ Uncompressed:", uncompressedLength, "| "+ (compressedLength / uncompressedLength).toFixed(3) +"%" ,"("+ deltaTime +"s)"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment