Why is this code's execution speed so different?
- by Steve Watkins
In Internet Explorer 7, this code executes consistently in 47 ms:
function updateObjectValues() {
$('.objects').html(12345678); // ~500 DIVs
}
however, this code executes consistently in 157 ms:
function updateObjectValues() {
$('.objects').html('12345678'); // ~500 DIVs
}
Passing a number is over 3x faster than a string. Why are these results so dramatically different? And, is there any way to help the performance of the string?