Monomorphism (v2)

Revision 2 of this benchmark created on


Setup

const add = (x, y) => x + y;
const addNumber = (x, y) => x + y;
const addString = (x, y) => x + y;
const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const strings = ['a', 'b', 'c'];

Test runner

Ready to run.

Testing in
TestOps/sec
add
let sum = 0
for(let i = 0; i < numbers.length; i++) sum = add(sum, numbers[i]);

let concat = ''
for(let i = 0; i < strings.length; i++) concat = add(concat, strings[i]);
ready
addNumber + addString
let sum = 0
for(let i = 0; i < numbers.length; i++) sum = addNumber(sum, numbers[i]);

let concat = ''
for(let i = 0; i < strings.length; i++) concat = addString(concat, strings[i]);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.