Big-array-remove-element

JavaScript performance comparison

Test case created by kamil-kielczewski

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var array = Array(1000*1000).fill(1);
  array[500000]=5;

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
A
var index = array.indexOf(5);
delete array[index];
pending…
B
var index = array.indexOf(5);
var arr = Array.from(array);
arr.splice(index, 1);
pending…
C
var index = array.indexOf(5);
array.splice(index, 1);
pending…
D
var arr = array.filter(item => item !== 5)
pending…
E
var index = array.indexOf(5);
var arr = array.filter((item,i) => i !== index)
pending…
F
var index = array.indexOf(5);
var arr= array.slice(0,index).concat(array.slice(index+1))
pending…
G
var index = array.indexOf(5);
var arr= [...array.slice(0,index), ...array.slice(index+1)]
pending…
H
var index = array.indexOf(5);
var arr = array.slice(0);
arr.splice(index, 1);
pending…

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

Compare results of other browsers

0 Comments