Sha256: c0fcc63631f22b39cd6031ad674280f9ffa137516b7b947f4060bf30837a01bf

Contents?: true

Size: 1.29 KB

Versions: 8

Compression:

Stored size: 1.29 KB

Contents

var path = require('path'),
    fs = require('fs'),
    sys = require('sys');

require.paths.unshift(__dirname, path.join(__dirname, '..'));

var less = require('lib/less');
var file = path.join(__dirname, 'benchmark.less');

if (process.argv[2]) { file = path.join(process.cwd(), process.argv[2]) }

fs.readFile(file, 'utf8', function (e, data) {
    var tree, css, start, end, total;

    sys.puts("Bechmarking...\n", path.basename(file) + " (" +
             parseInt(data.length / 1024) + " KB)", "");

    start = new(Date);

    new(less.Parser)({ optimization: 2 }).parse(data, function (err, tree) {
        end = new(Date);

        total = end - start;

        sys.puts("Parsing: " +
                 total + " ms (" +
                 parseInt(1000 / total *
                 data.length / 1024) + " KB\/s)");

        start = new(Date);
        css = tree.toCSS();
        end = new(Date);

        sys.puts("Generation: " + (end - start) + " ms (" +
                 parseInt(1000 / (end - start) *
                 data.length / 1024) + " KB\/s)");

        total += end - start;

        sys.puts("Total: " + total + "ms (" +
                 parseInt(1000 / total * data.length / 1024) + " KB/s)");

        if (err) {
            less.writeError(err);
            process.exit(3);
        }
    });
});

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
less-2.0.7 lib/less/js/benchmark/less-benchmark.js
less-2.0.6 lib/less/js/benchmark/less-benchmark.js
less-2.0.5 lib/less/js/benchmark/less-benchmark.js
less-2.0.4 lib/less/js/benchmark/less-benchmark.js
less-2.0.3 lib/less/js/benchmark/less-benchmark.js
less-2.0.2 lib/less/js/benchmark/less-benchmark.js
less-2.0.1 lib/less/js/benchmark/less-benchmark.js
less-2.0.0 lib/less/js/benchmark/less-benchmark.js