GC Improvements in JScript for Internet Explorer 8 Beta 1

Hello Friends,

Today I am going to talk about some of the Garbage Collector improvement we have done. Actually the original fix was done in Script 5.7 (shipped with IE7/Vista and also available on down level platforms), which we further enhanced in JScript shipped with IE8 Beta1.

So if you have gone through the Eric’s post on JScript Garbage Collector, you must have noticed following lines…

Actually what we do is keep track of the number of strings, objects and array slots allocated. We check the current tallies at the beginning of each statement, and when the numbers exceed certain thresholds we trigger a collection. “

“However, there are some down sides as well. Performance is potentially not good on large-working-set applications”.

The three thresholds he talked about were fixed in previous versions of JScript. After each GC cycle, counters were reset to zero. Next time when they hit the thresholds, again GC was triggered and so on.

This was alright for small scripts as they never create lot of strings and objects and don’t take much time to execute. But in modern AJAX applications, lots of objects /strings/array entries are created and they live for long enough time. Since rate of object/string/array entry creation is too high in these applications, thresholds are hit quite often, GC is triggered but not able to collect anything because things are still alive and there is no garbage. Counters are reset, but within few statements they again hit the thresholds. GC is triggered again but very less is collected and so on.

So as you see, GC is not able to collect significantly, however it is triggered at fixed intervals (as thresholds are fixed). Each GC cycle proves to be costlier than previous one as more objects have been created since last GC cycle happened.

So to fix this problem, we made the three thresholds adaptive. After each GC cycle, we check if GC was profitable or not, meaning significant collection happened or not. If it was not, then we double the thresholds. If it was, then the thresholds are not changed. Obviously there is an upper bound on value of thresholds, beyond which they are not doubled even if GC cycle was not profitable. Also if GC cycle collected everything, thresholds are set to their initial values.

That’s it for now. Hope you enjoyed reading it.

-JP

Comments

  • Anonymous
    April 23, 2008
    PingBack from http://microsoftnews.askpcdoc.com/?p=3993

  • Anonymous
    April 23, 2008
    What about future plans in this area? A generational GC for JScript could be interesting. AJAX applications would also benefit greatly from JScript going JIT, like Mozilla is heading with the Tamarin project.

  • Anonymous
    April 23, 2008
    I really hate how this is going to sound but: In the Silverlight example showing the difference between JavaSCript (silverlight 1.0) and C# (Silverlight 1.1/2.0), the Javacript version was 3 times slower on IE 7 than Firefox 2. What's the ratio now?

  • Anonymous
    April 23, 2008
    .NET Video: Write Your First Silverlight Game Increasing the Size of your Stack Web CSS 真的可以浮动么? xUnit

  • Anonymous
    April 23, 2008
    .NETVideo:WriteYourFirstSilverlightGameIncreasingtheSizeofyourStackWebCSS真的可以浮动么...

  • Anonymous
    April 29, 2008
    JP - Thanks for these posts! I love the fact that you guys are making a kick-a** implementation of JScript!! A couple of questions:

  1. I assume you guys are running tests like Sunspider, etc. (John Resig of jQuery fame has some too) to test your performance of JScript. Everyone else is ;-).
  2. When IE8 is finalized and shipping, is this newer JScript engine also going to be available for 'down-level' clients (like IE7) similar to the current Jscript 5.7 patch?
  3. Is this gonna be known as JScript 5.8 ;-) ?
  4. Can you guys fix the 'Process Manager' problem (I'm seeing it on Win XP, SP2, IE7) ? It 'lies' to you about how much memory the IE process is taking up, showing a huge amount of memory until you 'minimize' all IE windows. When you make the window visible again, the process shows that the memory is way down, usually about 50% of what it was before you minimized the window. It will slowing start to climb from there until you go through the same process. This doesn't affect the functionality of the application, its just worrisome to users who think that your web app is chewing up a bunch of memory. Thanks again!! Cheers,
  • Bill
  • Anonymous
    May 03, 2008
    Good improvements, I think. Is this something like multithreading technology? Or does MT work a lot different?

  • Anonymous
    May 20, 2008
    So what version will ship with IE8 RTM? WScript 5.8?

  • Anonymous
    May 28, 2008
    I understand that Microsoft is actively contributing to the es3.1 spec. This is useful. But where do you and Microsoft stand on ecmascript4 (es4)? There is a lot of good stuff in es4 even if initially it looks daunting. Javascript - even es3.1 - is not enough for the future of the web. Is Microsoft working on a "new language"?

  • Anonymous
    June 12, 2008
    The comment has been removed

  • Anonymous
    June 17, 2008
    (A whitepaper explaining this problem plus a comparison with Opera's and FireFox's implementations is available at: http://www.readableweb.com/forIEteam/IE8zoomanalysis.htm) At any zoom level other than 100% - a condition which can't be detected via script in IE8 - the new Zoom breaks the one and only available, standard, time honored, and widely deployed script technique for detecting the size of the browser window viewport in Internet Explorer. That one and only method of detection available in IE - the values of document.documentElement.clientWidth/Height (Standards Mode) or document.body.clientWidth/Height (Quirks Mode) are rendered unreliable for this purpose as an unintended consequence of IE8's new Zoom. Developers have been able to rely unquestioningly on these properties for this purpose for the past ten years. They no longer can.

  • Anonymous
    July 13, 2008
    I do is to web map programming, the map shows that this is the use of the mosaic map TABLE eg: <table> <tr> <td> <img src = "0_0.png" </ td> <td> <img src = "0_1.png" </ td> <td> <img src = "0_2.png" </ td> </ tr> </ table> But when I open this page often do not show the picture, I must be in the picture of regional mouse click can show that, Firefox can be directly displayed without onclick, I do not know what it is because I am distressed!

  • Anonymous
    July 26, 2008
    Thanks for sharing! Nice article!

  • Anonymous
    September 30, 2008
    I don't understand the table. can you please explain?

  • Anonymous
    February 08, 2009
    Great! Thanks for posting this info.

  • Anonymous
    March 05, 2009
    Thanks for sharing, i'm still not amused about using IE, firefox is the new way of life.

  • Anonymous
    April 17, 2009
    heey Thanks for that link mate I was looking for that and IE isn't it more me neighter Firefox is way better.

  • Anonymous
    April 17, 2009
    The comment has been removed

  • Anonymous
    April 24, 2009
    it's an Very nice and informatic articel I enjoyd reading it. thanks for it!

  • Anonymous
    November 11, 2009
    Great info, thanks for the post. Is Microsoft working on a "new language"? Has that been answered?

  • Anonymous
    January 18, 2010
    Found this article after some research. Read through the comments, but I don't understand the table posted by Handan. Thanks.

  • Anonymous
    January 22, 2010
    You should check out the IE8 readiness toolkit.

  • Anonymous
    January 25, 2010
    Very impressive implementation of JScript!!

  • Anonymous
    February 22, 2010
    Excellent information. It is a very informative article. Still a big fan of IE.

  • Anonymous
    March 01, 2010
    The comment has been removed

  • Anonymous
    March 05, 2010
    Thanks for sharing! Nice article, but I am a big fan of FF, but since IE is updating I might change back.

  • Anonymous
    March 20, 2010
    Recently switched back to IE, and MS has made huge improvements. Now with the browserwar coming up I am expecting great things and major improvements soon.

  • Anonymous
    March 28, 2010
    IE8 is very very good! Count me in as a new user, as I switched back from FF to IE. Great work!

  • Anonymous
    April 08, 2010
    Great work, i really love the outcome of IE8

  • Anonymous
    April 25, 2010
    The comment has been removed

  • Anonymous
    September 25, 2011
    ES3.1 is a step in the right direction, but as Brendan Eich and others have stated many times, its just not enough. http://www.delphindiva.org

  • Anonymous
    May 28, 2012
    Great info we used for www.r-go-tools.com/ergonomische_muis.html