function vs. no function (v2)

Revision 2 of this benchmark created on


Description

I Wanted to check, how bad the performance of a function is compared to using no function

Preparation HTML

<script>
  function inv(i) {
    if (i == 0) {
      return 1;
    } else {
      return 0;
    }
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Function
a = 1;
a = inv(a);

a = 0;
a = inv(a);
ready
No Function
a = 1;
if (a == 0) {
  a = 1;
} else {
  a = 0;
}

a = 0;
if (a == 0) {
  a = 1;
} else {
  a = 0;
}
ready

Revisions

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