Draw control and page description updates

Alistair Braidwood alistair_braidwood at yahoo.co.uk
Wed Dec 12 08:06:20 PST 2007


I'm struggling with the performance of my web app partly due to the unpredictability of when the browser decides to draw after (or while) I update the page description.

Firefox seems to draw on function boundaries and eg when I access document.body.clientHeight, so if I do something like:
    myDiv.innerHTML = "abc"
    h = document.body.clientHeight
    myDiv.className = getClassName()

The performance is worse than if I do:

    h = document.body.clientHeight
    myDiv.className = getClassName()

    myDiv.innerHTML = "abc"

because the former draws twice and the latter only once (obviously this example is grossly simplified)

It doesn't seem very practical or sensible to require the developer to order code in a specific way to avoid these sorts of performance penalties and my prefered solution would be to add "I'm about to edit the page description, please suspend drawing
ops" and "I've finished editing the page description, now you
may draw" functionality to the language - which is why I've mailed this group.


Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.mozilla.org/pipermail/es-discuss/attachments/20071212/b6866d78/attachment-0002.html 

More information about the Es4-discuss mailing list