Primitive string vs Wrapper Object String - get str value

Benchmark created on


Preparation HTML

str1 + " there" = <div id="id1"></div><br>
str2 + " there" = <div id="id2"></div>

Setup

var str1 = "Hello";
  var str2 = new String("Hello");
  
  var i = "(idle)",
      k = "(idle)";

Teardown



            var x = document.getElementById("id1"); x.innerHTML = i;
  var y = document.getElementById("id2"); y.innerHTML = k;
        
  

Test runner

Ready to run.

Testing in
TestOps/sec
Primitive value string str1 +
i = str1 + " there";
ready
Wrapper object string str2 +
k = str2 + " there";
ready

Revisions

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