Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Chrome 65
Linux
Other
7 years ago
Test name Executions per second
sort 96520.1 Ops/sec
reduce 579689.7 Ops/sec
Script Preparation code:
AخA
 
var a=Array.from({length:100},()=>Math.random())
Tests:
  • sort

     
    a.sort((a,b)=>a-b);
  • reduce

     
    a.reduce((a,c) => a < c ? a : c)