first char in string

JavaScript performance comparison

Test case created by first char in string

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var tmpString = 'hello';
    var firstChar = '';
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
chatAt
firstChar = tmpString.charAt(0);
pending…
subString
firstChar = tmpString.substring(0, 1);
pending…
index
firstChar = tmpString[0];
pending…

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

Compare results of other browsers

0 comments

Add a comment