Skip to content

Commit

Permalink
Title benchmark table with chunk size
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechilds committed May 28, 2017
1 parent 01e17b2 commit 67a7b42
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions benchmark/sync-vs-async.js
Expand Up @@ -8,6 +8,7 @@ const Table = require('cli-table');
const timeSpan = require('time-span');
const b64 = require('../');

const chunkSize = 250000;
const bytesToBenchmark = [10000, 100000, 1000000, 10000000, 100000000];

const log = text => {
Expand Down Expand Up @@ -36,16 +37,14 @@ const bench = noOfBytes => Promise.resolve().then(async () => {

log(`${humanBytes}: Encoding async...`);
end = timeSpan();
await b64(randomBytes);
await b64(randomBytes, { chunkSize });
results.encodeAsync = end();

log(`${humanBytes}: Decoding async...`);
end = timeSpan();
await b64(randomBytesBase64);
await b64(randomBytesBase64, { chunkSize });
results.decodeAsync = end();

log(``);

return results;
});

Expand All @@ -71,5 +70,6 @@ const bench = noOfBytes => Promise.resolve().then(async () => {
]);
}

log(`Benchmark completed with a chunk size of ${prettyBytes(chunkSize)}\n`);
console.log(table.toString());
})();

0 comments on commit 67a7b42

Please sign in to comment.