Re: nsGenericElement::InsertBefore performance
Boris Zbarsky <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Message-ID | <[email protected]> |
Andreas Pflug wrote: > Initialisation will still be several magnitudes faster, since all > controls will use their readily compiled handlers. Of course XBL also uses precompiled handlers... The real issue here is not the handlers. > I see the problem that XUL/XBL is used as if it was as cheap as it is > with typical gui lib Putting 8 images in a dialog is cheap with a typical GUI lib? > XUL/XBL is intended to do typical application programming (I think?) Yes. > but using typical programming > techniques will lead to poor results (unfortunately demonstrated by > Sunbird/Lightning, which appears as some kind of Mozilla demo app to me > since it's integrated into the mozilla source tree). Uh... That's a really really bad assumption. _Really_ bad. My basic point was that the code involved is just poorly written if one is at all interested in performance. >> Caching what, exactly? >> > A partial DOM. So instead of adding a bunch of nodes (which all need a > lot of basic initialisation), in a first step a partial tree of those > nodes is instantiated, not attached to the DOM (although probably > somewhat "prepared" for a specific document) XBL is shared across documents (and designed to be so), so this is actually not that useful. > and held in a caching area. Then when adding the xxxx-item a "cache using" node that will be > added to the DOM, consisting of a reference to the cached node tree, and > some individual data (e.g. label text). You just described the XUL prototype system. Which XBL uses, in fact, when cloning the subtree, if the subtree is XUL. > Easy, no? ;-) Not easy, but done! ;) > Actually, I don't quite understand your comment above. Do you say that > it's quite a lot of XBL-bound DOM stuff (that should be reduced) Yes. > but it will only be cloned if attached again and again? In this case, cloning > seems a) still much too costly and could b) be optimized if the partial > item's DOM isn't cloned (each cal-mon-day-item uses about 20k) but only > references a "template" DOM. See above. Cloning XUL produces lightweight XUL elements that point to the prototype element... It's already optimized for exactly this use case. -Boris