Boost script performance
by Geethalakshmi[ Edit ] 2010-09-16 21:03:43
Boost script performance
One of the best kept secrets to boosting script performance is to cache your objects. Often times, your script will repeatedly access a certain object, as in the following demonstration:
<script type="text/javascript">
for (i=0;i<document.images.length;i++)
document.images[i].src="blank.gif"
</script>
In the above, the object "document.images" is what's accessed multiple times. The code to realizing it is inefficient, since the browser must dynamically look up "document.images" twice during each loop (once to see if i
Tagged in: