Interesting details on IE10′s JavaScript performance tweaks
JavaScript, Short By Dave Ward. Updated June 13, 2012There’s a great article on the Internet Explorer team’s MSDN blog this week, Advances in JavaScript Performance in IE10 and Windows 8. I’ve been running Windows 8 as my primary OS for several weeks, and I must say (as bizarre as it feels to type these words), IE10 is incredibly fast and fluid. It’s almost like that first time you used Chrome after using Firefox with too many add-ons. Whatever they’re doing over there, it’s working.
The entire post was interesting, and you should probably read the whole thing if you’re a serious JavaScript developer. However, one point in particular stood out to me, regarding a new approach to deferred parsing:
The JSMeter project from Microsoft Research showed that typical Web pages use only a fraction of code that they download – generally on the order of 40-50%. Intuitively, this makes sense: developers often include popular JavaScript libraries like jQuery … but only leverage a fraction of the functionality the library supports.
To optimize such scenarios, Chakra performs only the most basic syntax-only parsing of the source code. The rest of the work (building the abstract syntax tree and generating bytecode) is performed one function at a time only when the function is about to be invoked. This strategy not only helps with the responsiveness of the browser when loading Web pages, but also reduces the memory footprint.
In IE9 there was one limitation of Chakra’s deferred parsing. Functions nested inside other functions had to be parsed immediately with their enclosing functions. This restriction proved important because many JavaScript libraries employ the so called “module pattern,” in which most of the library’s code is enclosed in a large function which is immediately executed. In IE10 we removed this restriction and Chakra now defers parsing and bytecode generation of any function that is not immediately executed.
Microsoft’s focus on real-world performance enhancement in IE9 and IE10 has been an under-appreciated breath of fresh air in the browser wars. Remember when everyone was competing to improve scores on synthetic JavaScript benchmarks instead of concentrating on actual on-page performance? I don’t miss those days.
If Microsoft would address the archaic extensibility model in Internet Explorer, I’d probably be using it to type this post right now. Given replacements for the dozen-ish essential extensions I use in Chrome, I could see myself being tempted to switch back to IE after ten years of Firefox and Chrome.
The landscape today is reminiscent of how things were shaping up just before so many of us began switching from Netscape to IE5/6, way back when. Never underestimate how fiercely Microsoft can compete and innovate when an entire division of the company commits to winning.
Similar posts
What do you think?
I appreciate all of your comments, but please try to stay on topic. If you have a question unrelated to this post, I recommend posting on the ASP.NET forums or Stack Overflow instead.
If you're replying to another comment, use the threading feature by clicking "Reply to this comment" before submitting your own.



I feel like Scully. You know, “I want to believe…”
Let’s face it, IE9 is not that great. It’s light years better than IE8, but all that means is it’s capable of rendering web sites created in the last five years or so. It’s still laggy, relatively unstable, and has a pretty irritating user interface. Maybe I just don’t use it enough to figure out how to disable notifications, but I find it’s constantly annoying me with stupid questions that other browsers don’t.
And of course the developer tools are atrocious compared to any other browser. Yes, a vast improvement, but being better than your old awful self doesn’t make you better than the competition. I really only use IE9 for debugging IE7 and IE8 problems when necessary.
So I’m still struggling to believe that IE10 is another huge step forward. IE9 closed the gap by about 50%, but that’s still a huge gap. But your point is taken, Microsoft does surprise sometimes, but do I see myself switching? It doesn’t have to be “about as good” as Chrome or whatever, it has to be BETTER. It’s not as if there are any major downsides to Chrome right now. The only thing I could see really convincing me would be awesome developer tools, but since that’s a lot of work for MS to do that only rewards them with a few nerds using IE, I’m not holding my breath.
@Jamie
I couldn’t agree more with everything you mentioned. As a web developer I’ve grown to hate (not dislike; hate) Internet Explorer. So I’m biased in that regard but as an end-user I very much prefer Chrome mainly because of the perceived performance and simplicity of the user experience.
In order for me to go back to IE, IE10 would need to be Chrome on steroids without all of the annoying Microsoft popup warnings and extra toolbar button malarkey and stuff that gets in the way of browsing the web. And it would need to be noticeably better than Chrome to pull me away at this point.
I strongly suspect that most of the IE market share is won by MS via OEM PC purchases and the fact that it ships as the default Windows browser “out of the box.” The average, non-tech savvy user is not likely going to change their browser (as easy as that is to do these days). Given that PC sales are on the decline I expect this will hurt IE further presenting a very steep hill for MS to climb.
Well, as far as development is concerned, Microsoft assumes you’re going to be using Visual Studio to develop stuff… and if you do that, then your developer tools are outstanding: line-by-line step through of JavaScript, with watches, breakpoints and so on; it’s really nice when you start running your projects in that environment. Which is free, I might add: you can download a basic Visual Studio 2010 from Microsoft.
There was time when I tell my non-techies friends to install FF/Chrome to make my support job (unavoidable) easier. Now I want them stick with IE for same exact reasons. It is most simple, just as fast and not having extensions actually a plus here :) So not using it myself much, but love others doing it.
IE10 is certainly fast… On my crapply ULV laptop, it’s quicker then Chrome running on my regular (much more powerful) desktop.
However, all the other issues with IE persist… The right click menu is full with useless cruft (really.. ‘translate’?!, print and print preview?!)
Still no SVG support. ’nuff said.
IE9 already has it.
As developers, we’ve always had to create one website version for FF/Chrome/Opera/Safari and a separate version for IE. Usually done with a hacks css file, and a couple of JS but really anything other than HTML 1.0 tags and JS ECMA 3 need complete rewrite or taken out for IE experience, so those hacks files tend to become quite like a website themselves. Double our work for what?
However, IE has pioneered some of the HTML5 concepts and the IE 9 and 10 have struggled to comply with the standards. Not all is bad. Now, switching back to IE may be a nice refresh more than anything, but the main issues of IE still remain: too tightly integrated in the system (security breaches), separate interpretation of HTML standards, awful developer tools.
While not exactly the same, one can minimize script loads on the server side by first placing non base function into separate individual files. When a given non base function is needed, the file is called with the include once command and the function called.
Any time an if statement makes a determination between multiple function calls, this practice can be used to minimize script load time and by extension, page load time.
I have heard that using the include is costly in resources, in practice however, loading tens and hundreds of lines of code that are not used, is more costly. The more code that is loaded into the compiler, the more time it takes for the compiler to finish. If the code is not loaded because of a lack of function call, that makes fewer lines of code for the compiler to compile and process.
When you consider how many megabytes of code that some frameworks have, it’s kind of a no brainer.
Scott A. Tovey
@Sutton I’m not sure you know what Firebug & Chrome Dev have to offer, you cannot possibly being to compare Visual Studio with the HTML / CSS / JS / Net & Ajax & auto-JSON preview, real-time console inside Chrome. VS is simply stone age when put next to Chrome (for web dev mind you, not for C#). Take a look, then try again to show the benefits of VS.
I’m inclined to agree, though honestly, I haven’t done much debugging in VS2010 because I never got past the headache of making it actually work against our development server. Strike one right there!
Google has been continually updating the Chrome debugging tools; a recent update added tabbed navigation of scripts and a few other things. It’s not perfect by any means; I think there is an opportunity for someone to make a really amazing debugger for javascript. Chrome still suffers from stability problems when debugging complex stuff sometimes; there are some wierd UI issues. Overall, I like it, and I think it’s the best there is right now, but I still think there’s much room for improvement.
VS is not a client script debugging tool, yeah, sure, some client side debugging capabilities have been added in the recent years but I feel extensions like FB or the chrome developer toolbar should be compared to IE’s developer tool bar instead… which I find to be very useful when debugging client code or examining the html/CSS of a page.
Meh. All you guys are missing out. Dragonfly is the best.
First time I tried Dragonfly, to deal with an opera-specific issue, it had a dealkiller bug: it ignored breakpoints sometimes. Which is of course the worst kind of bug, because you don’t realize it’s a bug in the debugger until you’ve pulled your hair out trying to figure out why your expected code path isn’t running. Maybe that problem is fixed now, but it certainly didn’t make me want to switch from Chrome.
This would all be relevant if only IE10 was available on Windows 7.
For the last 4-5 previews or so, Microsoft has only shown Windows 8 version. If they persist and limit IE10 to Win8, it’s as dead as Opera to most developers – nobody wants to develop for 1% of the market. As a user, it’s only relevant if I switch to Win8, which is not that likely because I don’t have a tablet (iPad does not count ;)) and on the desktop I really, really, *really* dislike having to go to Win8 start “page” instead of the start menu. I don’t see corporates switching to Win8 for the same reason. So I think the uptake will be rather slow, which will make IE10 rather uninsteresting for quite some time.
Hell, if they wanted to compete, they should have made IE10 for Vista, 7 and 8 (let’s all just leave XP to die, it’s been 11 years now).
And to the gentlemen who said “still no SVG support” – LOL :) SVG has been supported since IE9, I’ve used it and it works really well.
It’s my understanding that the final version of IE10 will be available for Windows 7 (but not Vista).
@Dave Ward
Yes, originally Microsoft announced that they will be making IE10 available for Windows 7.
However, not only is there no preview for Win7, Microsoft consistently refuses to comment publically or informally in blog comments about availability of Win7 ‘version’ of IE10.
So there’s a chance that they’ve ‘changed their mind’.
It’s a bit like availability of Web Sockets – someone decided that this technology is so fundamentally different that it requires Win8 and WinServer 2012. Yeah, right.
They’re just trying to push people to migrate by artificially limiting features. I wouldn’t be surprised if they did the same for IE10.
@Drazen: is this public enough for you?
https://twitter.com/IE/statuses/195535087843020800
“Hey #fronttrends attendees – #IE10 will be coming for Windows 7, we have not announced the date yet. It will run on Win 7 and Win 8.”
PS: I work for Microsoft
Never underestimate how fiercely Microsoft can compete and innovate when an entire division of the company commits to winning.
What were they committed to before? (I ask that more than half seriously.)
@Rey
No, it’s not. Why? Look at IE blog – each time a new preview comes out with a blog post, 80% of the first 50 comments are: “Win7 support?”
Not a single answer, even though blog is equally as informal as twitter.
So no, I won’t believe it till I see it.
@Drazen: Ok. So when it comes out, what then?
@Rey
So, IF it comes out :) then I’ll be happy.
Along the same those lines – if it doesn’t come out on Windows 7, what then?
@Drazen: If it doesn’t then it sounds like you won’t be happy. ;)
IE 10 is very fast, indeed a lot faster and smoother than Chrome. Another interesting thing about IE 10 is that it uses a lot lesser memory than Chrome/Firefox/Opera.
34 tabs (all sandboxed/running as processes) in just under 300 MB, Google could you believe this?
So, now that Windows 8 is “out” (at least for MSDN devs), where’s IE10 for Windows 7?
I understand that Windows 8 RTM does not mean that IE10 RTM’d on Windows 7, but no announcements whatsoever on the IE blog? Nothing? Highly irritating. They must be close to finishing on Windows 7, innards of IE10 can’t be that different between the two Windows versions.
I agree that IE 10 is much faster than its older versions. I think at last microsoft fixed their browser issues in past Versions.
@Drazen: Enjoy.
IE10 preview on Windows 7 available in November http://blogs.msdn.com/b/ie/archive/2012/10/17/ie10-on-windows-7-available-in-november.aspx