benchmark script can be passed files. also use optimization level 2, cause 3 doesn't exist anymore

This commit is contained in:
cloudhead 2010-06-20 22:17:41 -04:00
parent b25c0be5c7
commit 2ac0a98838

View File

@ -7,6 +7,8 @@ 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.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) {
@ -17,7 +19,7 @@ fs.stat(file, function (e, stats) {
start = new(Date);
new(less.Parser)({ optimization: 3 }).parse(data, function (err, tree) {
new(less.Parser)({ optimization: 2 }).parse(data, function (err, tree) {
end = new(Date);
total = end - start;