Skip to content

Commit

Permalink
fix: Fixed broken benchmark file speed stats
Browse files Browse the repository at this point in the history
  • Loading branch information
nonara committed Nov 28, 2020
1 parent 848bc00 commit d12b702
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,40 +35,40 @@ npm i -S node-html-parser

## Benchmarks
```
--------------------------------------------------------------------------------------
-------------------------------------------------------------------------------
node-html-makrdown (reused instance): 45.6265 ms/file ± 26.8280 (avg bytes/sec: 2.159)
node-html-markdown : 49.7005 ms/file ± 29.8097 (avg bytes/sec: 1.982)
turndown : 76.7837 ms/file ± 38.8597 (avg bytes/sec: 1.283)
turndown (reused instance) : 67.0672 ms/file ± 32.5577 (avg bytes/sec: 1.469)
node-html-makrdown (reused instance): 43.7098 ms/file ± 25.5440 (2.15 MB/s)
node-html-markdown : 44.6477 ms/file ± 26.7243 (2.1 MB/s)
turndown : 71.5919 ms/file ± 36.7715 (1.31 MB/s)
turndown (reused instance) : 67.5310 ms/file ± 36.7826 (1.39 MB/s)
--------------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Estimated processing times (fastest to slowest):
[node-html-makrdown (reused instance)]
100 kB: 47ms
1 MB: 486ms
50 MB: 24.29sec
1 GB: 8min, 17sec
50 GB: 6hr, 54min, 28sec
100 kB: 45ms
1 MB: 465ms
50 MB: 23.27sec
1 GB: 7min, 56sec
50 GB: 6hr, 37min, 3sec
[turndown (reused instance)]
100 kB: 70ms
1 MB: 714ms
50 MB: 35.70sec
1 GB: 12min, 11sec
50 GB: 10hr, 9min, 14sec
1 MB: 719ms
50 MB: 35.94sec
1 GB: 12min, 16sec
50 GB: 10hr, 13min, 27sec
--------------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Comparison to fastest (node-html-makrdown (reused instance)):
node-html-markdown: -8.20%
turndown (reused instance): -31.97%
turndown: -40.58%
node-html-markdown: -2.10%
turndown (reused instance): -35.27%
turndown: -38.95%
--------------------------------------------------------------------------------------
-------------------------------------------------------------------------------
```

## Usage
Expand Down
6 changes: 3 additions & 3 deletions benchmark/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const wrappers = fs.readdirSync(path.join(__dirname, 'wrapper'))

const MAX_WIDTH = Math.max(...wrappers.map(wrapper => wrapper.name.length));

const SEPARATOR = '\n' + '-'.repeat(MAX_WIDTH + 50) + '\n';
const SEPARATOR = '\n' + '-'.repeat(MAX_WIDTH + 43) + '\n';

// endregion

Expand Down Expand Up @@ -79,10 +79,10 @@ function humanTime(seconds) {
const name = formatName(item.name);
const mean = stat.mean.toPrecision(6);
const sd = stat.sd.toPrecision(6);
const avgBytesPerSec = (stat.avgBytesPerMs / 1000).toPrecision(4);
const avgBytesPerSec = (stat.avgBytesPerMs * 1000);

stats.push({ name, ...stat });
console.log(`${name}: ${mean} ms/file ± ${sd} (avg bytes/sec: ${avgBytesPerSec})`);
console.log(`${name}: ${mean} ms/file ± ${sd} (${humanFileSize(avgBytesPerSec)}/s)`);
});

runner.on('close', function (n) {
Expand Down

0 comments on commit d12b702

Please sign in to comment.