reverse shift VS pop reverse

JavaScript performance comparison

Revision 9 of this test case created by Gust van de Wal

Preparation code

<script>
  var array = []
  for (var i = 0; i < 10000; i++) array.push([10, 10, 10])
</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
.reverse().shift()
var x = []
for (var u = 0; u < array.length; u++) {
  x[u] = array[u].reverse().shift()
}
pending…
.pop().reverse()
var x = []
for (var u = 0; u < array.length; u++) {
  x[u] = array[u].pop().reverse()
}
pending…

Revisions

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

0 Comments