Javascript, IE, Strings, and Performance problems

Posted by Infinity on Stack Overflow See other posts from Stack Overflow or by Infinity
Published on 2010-03-13T00:00:03Z Indexed on 2010/03/13 0:07 UTC
Read the original article Hit count: 188

Filed under:
|
|

Hey guys,

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 (like this, and this), and try to sacrifice clean code for performance in the critical parts like DOM manipulation.

However, as you can see in this IE profiler screenshot.. alt text

Just "String" is the biggest offender. Almost 750ms of exclusive time.

Does this mean IE is spending 750ms just instantiating Strings? I also read this stuff on the Opera dev blog:

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)

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.

The library we use is MooTools 1.2.4

Any suggestions will be appreciated! Thx

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about Performance