if-assign vs assign-and (v3)

Revision 3 of this benchmark created on


Description

if( a ) { a = b; } versus a = a && b;

Setup

var a = true;
    var b = false;
    
    var truthy = true;

Test runner

Ready to run.

Testing in
TestOps/sec
if-assign from true
if (a) {
  a = truthy;
}
ready
if-assign from false
if (b) {
  b = truthy;
}
ready
and-assign from true
a = a && truthy;
ready
and-assign from false
a = a && truthy;
ready

Revisions

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