Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript: Optimizing details for Critical/Highly Processed Javascript code
    primarykey
    data
    text
    <p>I've been looking through a lot of Javascript Optimizing and most of them talk about string concatenation and a few other big ones found <a href="http://code.google.com/speed/articles/optimizing-javascript.html" rel="nofollow noreferrer">here</a>, but I figured there had to be <em>more details</em> that you can optimize for when speed is <strong>critical</strong> and the processing of those pieces of code is <strong>very high</strong>.</p> <p>Say you run this code for some reason: (unlikely, I know, but bear with me)</p> <pre><code>for( var i = 0; i &lt; 100000000000; i++ ) { //Do stuff } </code></pre> <p>And there's no way of getting around having a loop that big... You're going to want to make sure that all the stuff you're doing in that loop is optimized to the point that you can't optimize it anymore... or your website will hang.</p> <p><strong>Edit:</strong> I'm not necessarily talking about a loop, what about a function that's repeatedly called such as onmousemove? Although in most cases we shouldn't need to use onmousemove, <strong>there are some cases that do</strong>.<br/> <strong>This questions is for those cases.</strong></p> <p>Using JQuery as our JS library</p> <p>So what I would like is tips for optimizing, but only the more uncommon ones<br/> - ie. <a href="https://stackoverflow.com/questions/129029/which-is-faster-switch-or-if-else">Speed differences between switch or if-else</a></p> <p>If you'd like to see the more common ones, you can find them here:</p> <ul> <li><a href="http://archive.devnewz.com/2003/0527.html" rel="nofollow noreferrer">Optimizing Javascript for Execution Speed</a></li> <li><a href="https://stackoverflow.com/questions/724826/javascript-tips-and-tricks-javascript-best-practices">Javascript Tips and Tricks; Javascript Best Practices</a></li> <li><a href="https://stackoverflow.com/questions/959989/optimize-javascript-pre-load-of-images">Optimize javascript pre-load of images</a></li> <li><a href="https://stackoverflow.com/questions/197160/how-do-you-optimise-your-javascript">How do you optimize your Javascript</a></li> <li><a href="https://stackoverflow.com/questions/907225/object-oriented-javascript-best-practices">Object Oriented Javascript best practices</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload