.map().join() vs .reduce()

Benchmark created by agegorin on


Setup

const arr = [{text:'0'},{text:'1'},{text:'2'},{text:'3'},{text:'4'},{text:'5'},{text:'6'},{text:'7'},{text:'8'},{text:'9'}];

Test runner

Ready to run.

Testing in
TestOps/sec
.map().join()
arr.map((item) => item.text).join('');
ready
.reduce()
arr.reduce((r, b) => r + b.text, '');
ready

Revisions

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

  • Revision 1: published by agegorin on