Primitive value string vs Wrapper Object String - charAt() (v3)

Revision 3 of this benchmark created on


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.charAt(0)
i = str1.charAt(0);
ready
Wrapper object string str2["0"]
k = str2[0];
ready

Revisions

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