OZONE Asylum
Forums
DHTML/Javascript
IE JS/DOM performance degradation weirdness
This page's ID:
27610
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Writing to innerHTML doesn't work under true XHTML standards mode (eg. XHTML markup served with the [i]application/xhtml+xml[/i] MIME type), so I see using standard DOM methods as a more future-proof method. (Argue value of standards-based JS and future-proof value here, etc.) In my case and as [b]Poi [/b] pointed out, I am appending a single node with a large structure via appendChild() only once, so the behaviour (reflow etc. on the browser's part) should be the same as .innerHTML. My problem doesn't really seem to be that innerHTML or DOM is slow in "writing out" nodes, it's more so that DOM methods are [i]becoming slower[/i]. The degradation I'm seeing seems to relate to the javascript objects I'm creating, not so much to the complexity of the markup/DOM structure from what I can tell.. eg. several arrays of ~100 objects each, which are defined via object literal notation and constructors, are created for each "page" of content I'm parsing/rendering. (You can browse multiple "pages" within one view, next/previous-style.) [i]It seems like document.getElementsByTagName() is made slower, even when parsing "offline" nodes such as XML returned to an xmlhttprequest object[/i], as more pages are loaded. Some of the reading I've done seems to indicate that even though I may be actively removing elements from the DOM and retaining the nodes in Javascript, IE still seems to be reflecting the "weight" of those elements / objects. Because the behaviour seems to be linear and pretty consistent (each new page takes 500 msec more to get/display,) it sounds like a simple sort of "looping through a growing collection of objects takes longer" problem. If I have time and can isolate the behaviour to a minimal demo/example, I'll post a URL.
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »