convert string to char-code array (v13)

Revision 13 of this benchmark created by Trevor on


Setup

line = "This is the test string";
    cc = [];

Test runner

Ready to run.

Testing in
TestOps/sec
loop through array
for(var i = 0; i < line.length; ++i)
        cc[i] = line.charCodeAt(i);
ready
array.push
for(var i = 0; i < line.length; ++i)
        cc.push(line.charCodeAt(i));
ready
Array.prototype.slice.call
cc = Array.prototype.slice.call(line);
ready
String.prototype.split('')
cc = line.split('');
ready
without charCodeAt
for(var i = 0; i < line.length; ++i)
        cc[i] = line[i];
ready

Revisions

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