Re: nsGenericElement::InsertBefore performance
Andreas Pflug <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Message-ID | <[email protected]> |
Boris Zbarsky wrote:
> Andreas Pflug wrote:
>
>> The testcase is sunbird CVS (VC2008), one calendar, one visible event in
>> month view. Toggle the calendar off and on.
>>
>
> That's not really a testcase, because if nothing else I have no idea
> what code is running....
Well with a .mozconfig of
. $topsrcdir/calendar/sunbird/config/mozconfig
ac_add_options --disable-javaxpcom
ac_add_options --enable-chrome-format=flat
ac_add_options --enable-debug
ac_add_options --disable-optimize
make -f client.mk checkout; make -f client.mk build.
> Ideally, the testcase would be a standalone XUL file (plus possibly
> the XBL bindings needed) that I'd be able to run in any Gecko browser.
Maybe somebody with more sunbird/XUL knowledge can provide this.
> If sunbird is the only way to reproduce, you need _much_ more clear
> instructions to reproduce (click-by-click instructions).
>
Select month calendar view, create one simple event, then click the
calendar's checkbox on the left side to "off", start profiler, click
calendar on, stop profiler.
> oth shark (OSX) and sysprof or jprof (linux) can generate those; I'm
> sure there's a profiler for Windows that can too...
>
Yes, the VS2008 team edition, I don't have it.
Currently, things work like this:
for (i=0; i < 1000 ; i++) {
var box=document.createElementNS("...", "calendar-month-day-box-item");
box.setAttribute(...)
this.dayitems.insertBefore(box, null); // 5 ms per call
}
So actually the same initialization stuff is repeated all over again. I
wonder if some kind of caching mechanism could be invented:
var cachedBox=null;
for (i=0; i < 1000 ; i++) {
if (!cachedBox) {
cachedBox = document.createElementNS("...",
"calendar-month-day-box-item");
cachedBox.setAttribute(...)
document.prepareForRendering(cachedBox); // may take a while
}
var box=cachedBox.createCacheReference();
this.dayitems.insertBefore(box, null);
}
Regards,
Andreas