[Pkg-javascript-commits] [uglifyjs] 185/491: benchmark gzipped output (#2220)

Jonas Smedegaard dr at jones.dk
Wed Feb 14 19:51:34 UTC 2018


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag debian/3.3.10-1
in repository uglifyjs.

commit 4956ad311b363374211b7767b58b80098bac1ee3
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date:   Sun Jul 9 01:44:59 2017 +0800

    benchmark gzipped output (#2220)
---
 test/benchmark.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/test/benchmark.js b/test/benchmark.js
index e34f085..569d447 100644
--- a/test/benchmark.js
+++ b/test/benchmark.js
@@ -6,6 +6,7 @@
 var createHash = require("crypto").createHash;
 var fetch = require("./fetch");
 var fork = require("child_process").fork;
+var zlib = require("zlib");
 var args = process.argv.slice(2);
 if (!args.length) {
     args.push("-mc");
@@ -33,6 +34,7 @@ function done() {
             console.log(info.log);
             console.log("Original:", info.input, "bytes");
             console.log("Uglified:", info.output, "bytes");
+            console.log("GZipped: ", info.gzip, "bytes");
             console.log("SHA1 sum:", info.sha1);
             if (info.code) {
                 failures.push(url);
@@ -51,6 +53,7 @@ urls.forEach(function(url) {
     results[url] = {
         input: 0,
         output: 0,
+        gzip: 0,
         log: ""
     };
     fetch(url, function(err, res) {
@@ -65,6 +68,11 @@ urls.forEach(function(url) {
             results[url].sha1 = data.toString("hex");
             done();
         });
+        uglifyjs.stdout.pipe(zlib.createGzip({
+            level: zlib.Z_BEST_COMPRESSION
+        })).on("data", function(data) {
+            results[url].gzip += data.length;
+        });
         uglifyjs.stderr.setEncoding("utf8");
         uglifyjs.stderr.on("data", function(data) {
             results[url].log += data;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git



More information about the Pkg-javascript-commits mailing list