lib/benchmark.js
function doSyncBench(fn, callback) {

		var start,
		    fnOverhead,
		    pretotal,
		    result,
		    runs,
		    name;

		runs = 0;

		// For the initial test, to determine how many iterations we should
		// test later, we just use Date.now()
		start = Date.now();

		// See how many times we can get it to run for 50ms
		// This doesn't need to be precise yet. We don't use these results
		// for the ops count because Date.now() takes time, too
		do {
			fn();
			runs++;
			pretotal = Date.now() - start;
		} while (pretotal < 50);

		// See how long it takes to run an empty function
		fnOverhead = getFunctionOverhead(runs);

		result = syncTest(fn, runs, fnOverhead);

		if (callback) {
			result.name = fn.name || '';
			callback(null, result);
		} else {
			name = fn.name || '';
			if (name) name = 'for "' + name + '" ';

			console.log('Benchmark ' + name + 'did ' + Bound.Number.humanize(result.ops) + '/s (' + Bound.Number.humanize(result.iterations) + ' iterations)');
		}

		return result;
	}
function doSyncBench(fn, callback) {

		var start,
		    fnOverhead,
		    pretotal,
		    result,
		    runs,
		    name;

		runs = 0;

		// For the initial test, to determine how many iterations we should
		// test later, we just use Date.now()
		start = Date.now();

		// See how many times we can get it to run for 50ms
		// This doesn't need to be precise yet. We don't use these results
		// for the ops count because Date.now() takes time, too
		do {
			fn();
			runs++;
			pretotal = Date.now() - start;
		} while (pretotal < 50);

		// See how long it takes to run an empty function
		fnOverhead = getFunctionOverhead(runs);

		result = syncTest(fn, runs, fnOverhead);

		if (callback) {
			result.name = fn.name || '';
			callback(null, result);
		} else {
			name = fn.name || '';
			if (name) name = 'for "' + name + '" ';

			console.log('Benchmark ' + name + 'did ' + Bound.Number.humanize(result.ops) + '/s (' + Bound.Number.humanize(result.iterations) + ' iterations)');
		}

		return result;
	}
function doSyncBench ( fn , callback ) { var start , fnOverhead , pretotal , result , runs , name ; runs = 0 ; // For the initial test, to determine how many iterations we should // test later, we just use Date.now() start = Date . now ( ) ; // See how many times we can get it to run for 50ms // This doesn't need to be precise yet. We don't use these results // for the ops count because Date.now() takes time, too do { fn ( ) ; runs ++ ; pretotal = Date . now ( ) - start ; } while ( pretotal < 50 ) ; // See how long it takes to run an empty function fnOverhead = getFunctionOverhead ( runs ) ; result = syncTest ( fn , runs , fnOverhead ) ; if ( callback ) { result . name = fn . name || '' ; callback ( null , result ) ; } else { name = fn . name || '' ; if ( name ) name = 'for "' + name + '" ' ; console . log ( 'Benchmark ' + name + 'did ' + Bound . Number . humanize ( result . ops ) + '/s (' + Bound . Number . humanize ( result . iterations ) + ' iterations)' ) ; } return result ; }
Function that sets up the synchronous benchmark

@author   Jelle De Loecker   <jelle@develry.be>
@since    0.1.2
@version  0.1.2

@param    {Function}   fn
@param    {Function}   callback

@return   {Object}
Function that sets up the synchronous benchmark