return vs no return

Benchmark created by Alexis Deveria on


Description

How much does returning a value slow a function down?

Preparation HTML

<script>
  function noReturn(val) {
   val = val - 0;
  }
  
  function doesReturn(val) {
   val = val - 0;
   return val;
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
noReturn
noReturn(42);
ready
doesReturn
doesReturn(42);
ready

Revisions

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