Tweak benchmarks

This commit is contained in:
Vitaly Puzrin 2020-11-08 02:13:42 +03:00
parent 6607dbc18a
commit f681f66fd3
6 changed files with 19 additions and 10 deletions

View file

@ -10,7 +10,6 @@ var util = require('util');
var Benchmark = require('benchmark');
var ansi = require('ansi');
var cursor = ansi(process.stdout);
var b = require('buffer-from');
var pako = require('../');
@ -48,11 +47,9 @@ fs.readdirSync(SAMPLES_DIRECTORY).sort().forEach(function (sample) {
content.string = fs.readFileSync(filepath, 'utf8');
content.deflateTyped = pako.deflate(content.typed, { level: LEVEL });
content.deflateBuffer = b(content.deflateTyped);
content.deflateString = pako.deflate(content.typed, { level: LEVEL, to: 'string' });
content.gzipTyped = pako.gzip(content.typed, { level: LEVEL });
content.deflateRawTyped = pako.deflateRaw(content.typed, { level: LEVEL });
content.deflateRawBuffer = b(content.deflateRawTyped);
var title = util.format('(%d bytes raw / ~%d bytes compressed)', content.typed.length, content.deflateTyped.length);

View file

@ -3,7 +3,5 @@
var pako = require('../../../');
exports.run = function (data, level) {
return pako.deflate(data.typed, {
level: level
});
return pako.deflate(data.typed, { level: level });
};

View file

@ -0,0 +1,7 @@
'use strict';
var pako = require('../../../');
exports.run = function (data, level) {
return pako.gzip(data.typed, { level: level });
};

View file

@ -3,6 +3,5 @@
var pako = require('../../../');
exports.run = function (data) {
return pako.inflate(data.deflateTyped, {
});
return pako.inflate(data.deflateTyped, {});
};

View file

@ -3,5 +3,5 @@
var zlib = require('zlib');
exports.run = function (data) {
zlib.inflateSync(data.deflateBuffer);
zlib.inflateSync(data.deflateTyped);
};

View file

@ -0,0 +1,8 @@
'use strict';
var pako = require('../../../');
exports.run = function (data) {
return pako.ungzip(data.gzipTyped, {
});
};