Skip to content

Commit

Permalink
Move bench-folder in tests-folder
Browse files Browse the repository at this point in the history
First part of reorganizing and cleaning up test-folders.
  • Loading branch information
jaylinski committed Dec 29, 2021
1 parent c295ef0 commit 3bd0fa8
Show file tree
Hide file tree
Showing 28 changed files with 16 additions and 33 deletions.
15 changes: 0 additions & 15 deletions bench/.eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion tasks/metrics.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const metrics = require('../bench');
const metrics = require('../tests/bench');
const { createRegisterAsyncTaskFn } = require('./util/async-grunt-task');

module.exports = function(grunt) {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var _ = require('underscore'),

module.exports = function(grunt, callback) {
// Deferring to here in case we have a build for parser, etc as part of this grunt exec
var Handlebars = require('../lib');
var Handlebars = require('../../lib');

var templateSizes = {};
_.each(templates, function(info, template) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion bench/throughput.js → tests/bench/throughput.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function makeSuite(bench, name, template, handlebarsOnly) {

module.exports = function(grunt, callback) {
// Deferring load incase we are being run inline with the grunt build
Handlebars = require('../lib');
Handlebars = require('../../lib');

console.log('Execution Throughput');
runner(grunt, makeSuite, function(times, scaled) {
Expand Down
28 changes: 13 additions & 15 deletions bench/util/benchwarmer.js → tests/bench/util/benchwarmer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ function BenchWarmer() {
this.errors = {};
}

var print = require('util').print;

BenchWarmer.prototype = {
winners: function(benches) {
return Benchmark.filter(benches, 'fastest');
Expand Down Expand Up @@ -69,7 +67,7 @@ BenchWarmer.prototype = {

self.startLine('');

print('\n');
console.log('\n');
self.printHeader('scaled');
_.each(self.scaled, function(value, name) {
self.startLine(name);
Expand All @@ -78,7 +76,7 @@ BenchWarmer.prototype = {
self.writeValue(value[lang] || '');
});
});
print('\n');
console.log('\n');

var errors = false,
prop,
Expand All @@ -94,16 +92,16 @@ BenchWarmer.prototype = {
}

if (errors) {
print('\n\nErrors:\n');
console.log('\n\nErrors:\n');
Object.keys(self.errors).forEach(function(prop) {
if (self.errors[prop].error.message !== 'EWOT') {
bench = self.errors[prop];
print('\n' + bench.name + ':\n');
print(bench.error.message);
console.log('\n' + bench.name + ':\n');
console.log(bench.error.message);
if (bench.error.stack) {
print(bench.error.stack.join('\n'));
console.log(bench.error.stack.join('\n'));
}
print('\n');
console.log('\n');
}
});
}
Expand All @@ -112,7 +110,7 @@ BenchWarmer.prototype = {
}
});

print('\n');
console.log('\n');
},

scaleTimes: function() {
Expand Down Expand Up @@ -163,11 +161,11 @@ BenchWarmer.prototype = {
}

if (winners) {
print('WINNER(S)');
console.log('WINNER(S)');
horSize = horSize + 'WINNER(S)'.length;
}

print('\n' + new Array(horSize + 1).join('-'));
console.log('\n' + new Array(horSize + 1).join('-'));
},

startLine: function(name) {
Expand All @@ -179,8 +177,8 @@ BenchWarmer.prototype = {

this.currentBenches = [];

print(winners.join(', '));
print('\n');
console.log(winners.join(', '));
console.log('\n');

if (name) {
this.writeValue(name);
Expand Down Expand Up @@ -216,7 +214,7 @@ BenchWarmer.prototype = {
writeValue: function(out) {
var padding = this.benchSize - out.length + 1;
out = out + new Array(padding).join(' ');
print(out);
console.log(out);
}
};

Expand Down
File renamed without changes.

0 comments on commit 3bd0fa8

Please sign in to comment.