Array#push vs spread operator

Edit on GitHub

Setup

var arr = [];

Tests

  • Array#push

    for (var i = 0; i < 10000; i++) {
      arr.push(i)
    }
  • spread operator

    for (var i = 0; i < 10000; i++) {
      arr = [...arr, i];
    }