Function vs. Inline (v10)

Revision 10 of this benchmark created by sansegot on


Preparation HTML

<script>
var runs = 1000,
  curr = 500,
  min = 1000,
  minX = 1000,
  popis = [],
  popisX = [];

  var testerFunction2 = function(i) {
    if(i>curr) {
      if(i===min) {
        popis.push(i);
      } else if(i < min) {
        min = i;
        popis = [i];
      }
      if(i===minX) {
        popisX.push(i);
      } else if(i < minX) {
        minX = i;
        popisX = [i];
      }
    }
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
function call double
for (var i = 0; i < runs; i++) {
 var a = testerFunction2(i);
}
ready
inline double
for (var i = 0; i < runs; i++) {
    if(i>curr) {
      if(i===min) {
        popis.push(i);
      } else if(i < min) {
        min = i;
        popis = [i];
      }
      if(i===minX) {
        popisX.push(i);
      } else if(i < minX) {
        minX = i;
        popisX = [i];
      }
    }
}
ready

Revisions

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