Skip to content

Commit

Permalink
formatting results
Browse files Browse the repository at this point in the history
  • Loading branch information
alexreardon committed Oct 19, 2021
1 parent ce0c6bf commit 4c5409b
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions benchmarks/library-comparison.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@ const libraries = [
name: 'no memoization',
memoize: (fn) => fn,
},
// {
// name: 'memoize-one',
// memoize: memoizeOne,
// },
// {
// name: 'lodash.memoize',
// memoize: lodash,
// },
// {
// name: 'fast-memoize',
// memoize: fastMemoize,
// },
// {
// name: 'moize',
// memoize: moize,
// },
// {
// name: 'memoizee',
// memoize: memoizee,
// },
// {
// name: 'mem (JSON.stringify strategy)',
// // mem supports lots of strategies, choosing a 'fair' one for lots of operations
// memoize: (fn) => mem(fn, { cacheKey: JSON.stringify }),
// },
{
name: 'memoize-one',
memoize: memoizeOne,
},
{
name: 'lodash.memoize',
memoize: lodash,
},
{
name: 'fast-memoize',
memoize: fastMemoize,
},
{
name: 'moize',
memoize: moize,
},
{
name: 'memoizee',
memoize: memoizee,
},
{
name: 'mem (JSON.stringify strategy)',
// mem supports lots of strategies, choosing a 'fair' one for lots of operations
memoize: (fn) => mem(fn, { cacheKey: JSON.stringify }),
},
];

function slowFn() {
Expand Down Expand Up @@ -136,11 +136,12 @@ scenarios.forEach((scenario) => {
return [index + 1, benchmark.name, Math.round(benchmark.hz).toLocaleString()];
});

console.log('Markdown:\n');
console.log('\nMarkdown:\n');
console.log(`**${scenario.name}**\n`);
const table = markdownTable([['Position', 'Library', 'Operations per second'], ...rows]);

const table = markdownTable([['Position', 'Library', 'Operations per second'], ...rows]);
console.log(table);
console.log('');
});
suite.run();
});

0 comments on commit 4c5409b

Please sign in to comment.