SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    May 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    IE9 Javascript Slowness

    Hi all

    I'm having difficulty in explaining why the following code runs slower in IE9 than IE8! (Testing in Win 7 IE9 both 32 bit and 64 bit running in VMWare 3 virtual machine on OS X 10.6.7)

    Here's some test code that runs smoothly in about half a second in (latest) FF/Chrome/Safari on OS X, WinXP, and Win7 plus IE7 & 8 on WinXP (for simplicity I removed the tweak that makes it work in IE6).

    For some reason I can't explain, it's awful in IE9, slow and clunky. Reducing the time for the setTimeout makes it a bit quicker but no less jerky.

    I've tried removing and benchmarking a number of what might be the choke points (Math.min for example ... all with no change.

    I'm stumped ... can anyone please point me in the right direction?... preferably one that does not require browser-sniffing?

    Here's the test code ...

    <div id = 'panel' class='noShow' style='background-color: #aaa;'>
    <div id = 'wrapper' class='slideWrapper'>
    <p>xxxxxxxxxxx</p><p>xxxxxxxxxxx</p><p>xxxxxxxxxxx</p><p>xxxxxxxxxxx</p><p>xxxxxxxxxxx</p><p>xxxxxxxxxxx</p><p>xxxxxxxxxxx</p><p>xxxxxxxxxxx</p><p>xxxxxxxxxxx</p><p>xxxxxxxxxxx</p>
    </div>
    </div>


    <script type = 'text/javaScript'>

    var e = document.getElementById('panel');
    var w = document.getElementById('wrapper');

    w.style.overflow = 'hidden';
    w.style.height = '1px';
    var sh = w.scrollHeight;
    show();
    function show()
    {
    setTimeout(function()
    {
    w.style.height = Math.min(sh, (w.offsetHeight + Math.ceil(sh/15))) + 'px';
    if(
    (w.offsetHeight < sh)
    )
    {
    show(e);
    }
    else
    {
    w.style.height = 'auto';
    }
    }, 20);
    }
    </script>

    All ideas gratefully received... thanks in advance.

    GeeBee

    PS Posted this on stackoverflow.com without success - hopefully sitepoint.com readers can help?

    PPS Sorry if this is a double-post ... I *thought* I posted this some hour or so ago but I can't see it on the forum at all. Maybe I goofed?

    PPPS Hmmm... the editor removed the tabs in the .js, sorry.
    Last edited by expr3ss; May 14, 2011 at 21:13. Reason: Typo in para #1 - 64bit not 63!

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by expr3ss View Post
    I'm having difficulty in explaining why the following code runs slower in IE9 than IE8! (Testing in Win 7 IE9 both 32 bit and 64 bit running in VMWare 3 virtual machine on OS X 10.6.7)
    It runs smooth-as in IE9 on Vista, so I'd point my finger at either Windows 7 (unlikely) or the virtual machine (more likely).

    The next things to investigate would be:
    • IE9 on Windows 7
    • IE9 in a VM on Windows
    • Standard performance tests in IE9 in Windows VM on the Mac.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Member
    Join Date
    May 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Paul... that's very helpful. We don't have a native Win7 machine (only a little Dell Inspiron Atom running XP) and so can't test any further.

    The test code runs perfectly in IE7 & 8 VMWare Fusion 3 WinXP machines, as you report it does in Vista with IE9. If you or anyone else out there can comment on native Win7 with IE9 that would be very helpful.

    Thanks again for your help so far.

    Cheers

    GeeBee


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •