mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Update tests to meet semistandard code standards
Switch to const/let instead of var
This commit is contained in:
@@ -2,43 +2,43 @@
|
||||
|
||||
process.env.UV_THREADPOOL_SIZE = 64;
|
||||
|
||||
var assert = require('assert');
|
||||
var async = require('async');
|
||||
const assert = require('assert');
|
||||
const async = require('async');
|
||||
|
||||
var sharp = require('../../index');
|
||||
var fixtures = require('../fixtures');
|
||||
const sharp = require('../../index');
|
||||
const fixtures = require('../fixtures');
|
||||
|
||||
var width = 720;
|
||||
var height = 480;
|
||||
const width = 720;
|
||||
const height = 480;
|
||||
|
||||
sharp.concurrency(1);
|
||||
sharp.simd(true);
|
||||
|
||||
var timer = setInterval(function() {
|
||||
const timer = setInterval(function () {
|
||||
console.dir(sharp.counters());
|
||||
}, 100);
|
||||
|
||||
async.mapSeries([1, 1, 2, 4, 8, 16, 32, 64], function(parallelism, next) {
|
||||
var start = new Date().getTime();
|
||||
async.mapSeries([1, 1, 2, 4, 8, 16, 32, 64], function (parallelism, next) {
|
||||
const start = new Date().getTime();
|
||||
async.times(parallelism,
|
||||
function(id, callback) {
|
||||
/*jslint unused: false */
|
||||
sharp(fixtures.inputJpg).resize(width, height).toBuffer(function(err, buffer) {
|
||||
function (id, callback) {
|
||||
/* jslint unused: false */
|
||||
sharp(fixtures.inputJpg).resize(width, height).toBuffer(function (err, buffer) {
|
||||
buffer = null;
|
||||
callback(err, new Date().getTime() - start);
|
||||
});
|
||||
},
|
||||
function(err, ids) {
|
||||
function (err, ids) {
|
||||
assert(!err);
|
||||
assert(ids.length === parallelism);
|
||||
var mean = ids.reduce(function(a, b) {
|
||||
const mean = ids.reduce(function (a, b) {
|
||||
return a + b;
|
||||
}) / ids.length;
|
||||
console.log(parallelism + ' parallel calls: fastest=' + ids[0] + 'ms slowest=' + ids[ids.length - 1] + 'ms mean=' + mean + 'ms');
|
||||
next();
|
||||
}
|
||||
);
|
||||
}, function() {
|
||||
}, function () {
|
||||
clearInterval(timer);
|
||||
console.dir(sharp.counters());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user