From ef54fc0884068c8247d015da438c1274267e6fe3 Mon Sep 17 00:00:00 2001 From: GoalSmashers Date: Mon, 28 Oct 2013 08:59:53 +0100 Subject: [PATCH] Adds missing `@import` processing to our benchmark (run via `npm run bench`) --- History.md | 2 ++ test/bench.js | 7 +++++-- test/data-bench/_partial.css | 1 + test/data-bench/complex.css | 4 ++++ 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 test/data-bench/_partial.css create mode 100644 test/data-bench/complex.css diff --git a/History.md b/History.md index 2019cd25..3101be16 100644 --- a/History.md +++ b/History.md @@ -3,6 +3,8 @@ * Adds simplified and more advanced text escaping / restoring via `EscapeStore` class. * Adds simplified and much faster empty elements removal. +* Adds simplified and much faster empty elements removal. +* Adds missing `@import` processing to our benchmark (run via `npm run bench`). 1.1.6 / 2013-10-26 ================== diff --git a/test/bench.js b/test/bench.js index 8b618d31..aa6afcbd 100644 --- a/test/bench.js +++ b/test/bench.js @@ -1,13 +1,16 @@ var cleanCSS = require('../index'); -var bigcss = require('fs').readFileSync(require('path').join(__dirname, 'data', 'big.css'), 'utf8'); +var path = require('path'); if (!process.hrtime) { console.log('process.hrtime() (node.js > 0.7.6) is required for benchmarking'); process.exit(1); } +var benchDir = path.join(__dirname, 'data-bench'); +var cssData = require('fs').readFileSync(path.join(benchDir, 'complex.css'), 'utf8'); + var start = process.hrtime(); -cleanCSS.process(bigcss, { benchmark: true }); +cleanCSS.process(cssData, { benchmark: true, root: benchDir }); var itTook = process.hrtime(start); console.log('complete minification: %d ms', 1000 * itTook[0] + itTook[1] / 1000000.0); diff --git a/test/data-bench/_partial.css b/test/data-bench/_partial.css new file mode 100644 index 00000000..f8ce6803 --- /dev/null +++ b/test/data-bench/_partial.css @@ -0,0 +1 @@ +@import '../data/blueprint.css'; diff --git a/test/data-bench/complex.css b/test/data-bench/complex.css new file mode 100644 index 00000000..1e53b24e --- /dev/null +++ b/test/data-bench/complex.css @@ -0,0 +1,4 @@ +@import '../data/reset.css'; +@import '_partial.css'; +@import '../data/960.css'; +@import '../data/big.css'; -- 2.34.1