Alois Reitbauer About the Author

dynaTrace @ Velocity Berlin

Velocity Velocity comes to Europe and we will are there. You can find our presentations and links here. Today we had a talk on What it means to deliver exceptional performance and tomorrow Andi will give a Lightning Demo. Hope to see you there

 

JavaScript Performance Challenge

If you think you are a Web performance ninja, guru or the like you should also enter the dynaTrace JavaScript performance challenge. Just find out which of the code snippets below is the fastest.

Method A
function codeSampleA() {
 $.each($(".myClassA"), function (i, element) {
  $(this).css("color", "red");
  $(this).css("font-size", "10");
 });
}

Method B
function codeSampleB() {
  var allAs = $("a.myClassA");
 allAs.css("color", "red");
 allAs.css("font-size", "10");
}

Method C
function codeSampleC() {
 var allAs = $(".myClassA");
 allAs.css("color", "red");
 allAs.css("font-size", "10");
}

Method D
function codeSampleD() {
 $("a.myClassA").css("color", "red");
 $("a.myClassA").css("font-size", "10");
}

Comments

*


four − = 2