mirror of
https://github.com/0x5eal/rbxts-pako.git
synced 2025-04-04 10:50:59 +01:00
Added level param to benchmarks
This commit is contained in:
parent
822310eb43
commit
7deacf94a3
5 changed files with 11 additions and 9 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
var LEVEL = 6;
|
||||
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
@ -69,12 +70,12 @@ fs.readdirSync(SAMPLES_DIRECTORY).sort().forEach(function (sample) {
|
|||
|
||||
fn: function (deferred) {
|
||||
if (!!impl.code.async) {
|
||||
impl.code.run(content, function() {
|
||||
impl.code.run(content, LEVEL, function() {
|
||||
deferred.resolve();
|
||||
return;
|
||||
});
|
||||
} else {
|
||||
impl.code.run(content, deferred);
|
||||
impl.code.run(content, LEVEL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
var deflate = require('./deflate');
|
||||
|
||||
exports.run = function(data) {
|
||||
return deflate(data);
|
||||
exports.run = function(data, level) {
|
||||
return deflate(data, level);
|
||||
}
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
var deflate = require('./deflate');
|
||||
|
||||
exports.run = function(data) {
|
||||
// Compression levels not supported. Use unknown defaults always
|
||||
return deflate(data);
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
var pako = require('../../../index.js');
|
||||
|
||||
exports.run = function(data) {
|
||||
exports.run = function(data, level) {
|
||||
return pako.deflate(data, {
|
||||
level: 0
|
||||
level: level
|
||||
});
|
||||
}
|
||||
|
|
|
@ -4,12 +4,12 @@ var zlib = require('zlib');
|
|||
|
||||
exports.async = true;
|
||||
|
||||
exports.run = function(data, callback) {
|
||||
exports.run = function(data, level, callback) {
|
||||
//zlib.deflate(new Buffer(data), callback);
|
||||
|
||||
var zlibStream = zlib.createDeflate({
|
||||
/*chunkSize: 128*1024,
|
||||
level: 0*/
|
||||
/*chunkSize: 128*1024,*/
|
||||
level: level
|
||||
});
|
||||
var buffers = [], nread = 0;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue