return vs no return (v4)

Revision 4 of this benchmark created on


Description

How much does returning a value slow a function down?

Preparation HTML

<script>
  function callback(val) {}

  function noReturn(val) {
   val = val - 0;
  }
  
  function doesReturn(val) {
   val = val - 0;
   return callback(val);
  }

  function doesValuelessReturn(val) {
    val = val - 0;
    callback(val);
    return;
  }
</script>

Test runner

Ready to run.

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

Revisions

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