Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript, IE, Strings, and Performance problems
    primarykey
    data
    text
    <p>So we have this product, and it's really slow in IE. We've already applied a lot of the practices advised by the IE guys themselves (<a href="http://blogs.msdn.com/ie/archive/2006/08/28/728654.aspx" rel="nofollow noreferrer">like this</a>, and <a href="http://blogs.msdn.com/ie/archive/2007/01/04/ie-jscript-performance-recommendations-part-3-javascript-code-inefficiencies.aspx" rel="nofollow noreferrer">this</a>), and try to sacrifice clean code for performance in the critical parts like DOM manipulation.</p> <p>However, as you can see in this IE profiler screenshot.. <a href="http://i43.tinypic.com/24g57c1.png" rel="nofollow noreferrer">alt text http://i43.tinypic.com/24g57c1.png</a></p> <p>Just "String" is the biggest offender. Almost 750ms of exclusive time.</p> <p>Does this mean IE is spending 750ms just instantiating Strings? I also read this stuff on the <a href="http://dev.opera.com/articles/view/javascript-best-practices/" rel="nofollow noreferrer">Opera dev blog</a>:</p> <blockquote> <p>A build script can remove whitespace, comments, replace strings with Array lookups (to avoid MSIE creating a string object for every single instance of a string — even in conditions)</p> </blockquote> <p>But no more info regarding this. Anyone can clarify? It seems like IE has to create a full String instance every time you have " " in your code, which could explain this, but I don't know what the array lookup optimization would look like. BTW- we don't really do much of string concatenation anywhere in the code.</p> <p>The library we use is MooTools 1.2.4 </p> <p>Any suggestions will be appreciated! Thx</p> <p>UPDATE- I'm particularly interested in the tip mentioned above about "array lookup optimization". Our library is big (1MB) so it has a lot of strings in it, like any other JS code. But since our library is bigger than most, these Strings are actually causing speed issues. </p> <p>Also, does anybody know if adding stuff to the String.prototype makes every instance slower?</p>
    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.
    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