undefined vs local undefined var (v2)

Revision 2 of this benchmark created by @blixt on


Setup

function test1(stuff) {
      if (stuff === undefined) {
        stuff += stuff; // never reached
      }
    }
    
    function test2(stuff, u) {
      if (stuff === u) {
        stuff += stuff; // never reached
      }
    }

Test runner

Ready to run.

Testing in
TestOps/sec
global undefined
test1(1);
ready
local undefined var
test2(1);
ready

Revisions

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