string iteration

JavaScript performance comparison

Test case created by ju1ius

Preparation code

<script>
var text = "外国語の学習と教授 Language Learning and Teaching"
  + " Изучение и обучение иностранных языков Tere Daaheng Aneng Karimah"
  + " 語文教學・语文教学 Enseñanza y estudio de idiomas"
  + " Изучаване и Преподаване на Чужди Езици"
  + " ქართული ენის შესწავლა და სწავლება"
  + " 'læŋɡwidʒ 'lɘr:niŋ ænd 'ti:tʃiŋ"
  + " ללמוד וללמד את השֵפה"
  + " L'enseignement et l'étude des langues"
  + " Nauka języków obcych"
  + " Γλωσσική Εκμὰθηση και Διδασκαλία "
  + " Sprachlernen und -lehren "
  + " เรียนและสอนภาษา"
  + " Lus kawm thaib qhia"
  + " Ngôn Ngữ, Sự học",
  len = text.length;
</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
bracket notation
for (var i = 0, char; i < len; i++) {
  char = text[i];
}
pending…
charAt
for (var i = 0, char; i < len; i++) {
  char = text.charAt(i);
}
pending…
split and iterate array
for (var i = 0, char, buffer = text.split(''); i < len; i++) {
  char = buffer[i];
}
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