From: Jakub Pawlowicz Date: Mon, 9 Jan 2017 10:52:12 +0000 (+0100) Subject: Runs benchmark on each optimization level. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=47486aab3749ed0a3ccfc98bfb26c2e61aa123df;p=clean-css.git Runs benchmark on each optimization level. --- diff --git a/test/bench.js b/test/bench.js index a7f04f38..227af6ad 100644 --- a/test/bench.js +++ b/test/bench.js @@ -1,14 +1,22 @@ var CleanCSS = require('../index'); var input = '@import url(test/fixtures/bench/complex.css);'; -var total = 0; +var total; +var level; +var i; +var start; +var itTook; -for (var i = 1; i <= 10; i++) { - var start = process.hrtime(); - new CleanCSS().minify(input); +for (level = 0; level < 3; level ++) { + total = 0; - var itTook = process.hrtime(start); - total += 1000 * itTook[0] + itTook[1] / 1000000; -} + for (i = 1; i <= 10; i++) { + start = process.hrtime(); + new CleanCSS({ level: level }).minify(input); + + itTook = process.hrtime(start); + total += 1000 * itTook[0] + itTook[1] / 1000000; + } -console.log('Complete minification averaged over 10 runs: %d ms', total / 10); + console.log('Average over 10 runs on level %d: %d ms', level, total / 10); +}