String to Char Array

JavaScript performance comparison

Test case created by KyleMit

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  let sentence = "Hello World"

};
</script>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Array.from
let output = Array.from(sentence)
pending…
Spread Operator
let output = [...sentence]
pending…
Split
let output = sentence.split("")
pending…
Object.Assign
let output = Object.assign([],sentence)
pending…
Array.map
let output = [].map.call(sentence, c => c)
pending…
for i loop + push
let output = []
for(i=0; i < sentence.length; i++) {
   output.push(sentence[i])
}
pending…
for of loop + push
let output = []
for (let c of sentence) {
	output.push(c)  
}
pending…

Compare results of other browsers

Revisions

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

0 Comments