benchmarking!

This commit is contained in:
cloudhead 2010-02-25 18:02:07 -05:00
parent 22b4380645
commit 9de16ff637
2 changed files with 8006 additions and 0 deletions

7971
benchmark/benchmark.less Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
var path = require('path'),
fs = require('fs'),
sys = require('sys');
require.paths.unshift(__dirname, path.join(__dirname, '..'));
var less = require('lib/less/adapters/server');
var file = path.join(__dirname, 'benchmark.less');
fs.stat(file, function (e, stats) {
fs.open(file, process.O_RDONLY, stats.mode, function (e, fd) {
fs.read(fd, stats.size, 0, "utf8", function (e, data) {
var tree, css, start, end;
sys.puts("Bechmarking... " + path.basename(file), "");
start = new(Date);
tree = less.parser.parse(data);
end = new(Date);
sys.puts("Parsed " + parseInt(data.length / 1024) + " KB in " +
((end - start) / 1000) + "s (" +
parseInt(1000 / (end - start) *
data.length / 1000) + " KB\/s)");
start = new(Date);
css = tree.toCSS([], {frames: []});
end = new(Date);
sys.puts("Generated " + parseInt(css.length / 1024) + " KB in " +
(end - start) + " ms (" +
(1000 / (end - start) * css.length / 1000) + " KB\/s)");
});
});
});