mirror of
https://github.com/0x5eal/rbxts-pako.git
synced 2025-04-04 10:50:59 +01:00
Tweak benchmarks
This commit is contained in:
parent
6607dbc18a
commit
f681f66fd3
6 changed files with 19 additions and 10 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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 });
|
||||
};
|
||||
|
|
7
benchmark/implementations/gzip-pako/index.js
Normal file
7
benchmark/implementations/gzip-pako/index.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
var pako = require('../../../');
|
||||
|
||||
exports.run = function (data, level) {
|
||||
return pako.gzip(data.typed, { level: level });
|
||||
};
|
|
@ -3,6 +3,5 @@
|
|||
var pako = require('../../../');
|
||||
|
||||
exports.run = function (data) {
|
||||
return pako.inflate(data.deflateTyped, {
|
||||
});
|
||||
return pako.inflate(data.deflateTyped, {});
|
||||
};
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
var zlib = require('zlib');
|
||||
|
||||
exports.run = function (data) {
|
||||
zlib.inflateSync(data.deflateBuffer);
|
||||
zlib.inflateSync(data.deflateTyped);
|
||||
};
|
||||
|
|
8
benchmark/implementations/ungzip-pako/index.js
Normal file
8
benchmark/implementations/ungzip-pako/index.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
var pako = require('../../../');
|
||||
|
||||
exports.run = function (data) {
|
||||
return pako.ungzip(data.gzipTyped, {
|
||||
});
|
||||
};
|
Loading…
Add table
Reference in a new issue