There are a few places within the ADG code where the code loops over every
single item renderer and needlessly (or at least excessively) calls
validateNow() on each renderer. That forces the renderers to each relayout
and draw themselves and does not allow the delayed layout processing that
the framework is supposed to allow.
See the updateDisplayOfItemRenderer() method in AdvancedDataGridBase and
you'll find this function:
protected function updateDisplayOfItemRenderer(r:IListItemRenderer):void
{
if (r is IInvalidating)
{
var ui:IInvalidating = IInvalidating(r);
ui.invalidateDisplayList();
ui.validateNow();
}
}
that gets run waaay too often.
Also see the drawCellItem() method of AdvancedDataGrid, which down at the
bottom of the method has this call:
if (item is IFlexDisplayObject)
{
if (item is IInvalidating)
{
IInvalidating(item).invalidateDisplayList();
IInvalidating(item).validateNow();
}
}
So basically every time your data grid is redrawing itself it takes way
longer than it should. I created an extended version of ADG and overrode
those two methods (had to copy/paste most of the drawCellItem method) and I
removed the calls to validateNow, seemed to speed things up a lot.
Doug
On Thu, Sep 4, 2008 at 8:06 AM, Adrian Williams
<[EMAIL PROTECTED]>wrote:
> All,
>
> I am seeing some incredible lag while using a couple of simple panels
> and a complex ADG. While I love the flexibility and power of Flex/AS and
> the ADG, I really need to overcome these performance problems or the
> project will sink.
>
> My ADG has approx. 100 columns with approx. 200 rows, in a grouping
> collection that contains approx 30 groups.
>
> I suspect the lag I am seeing has to do with the redrawing of the
> rows. Whenever I scroll or collapse/expand the nodes, it takes between 1/2
> to 1 second for the action to complete. And this isn't even a very large
> dataset...we have some that have a few thousand rows. I haven't used any
> item rendering (yet) that would slow the speed down, though I have two
> columns that have style functions attached. All in all, this is about as
> close to display the raw data as I can get.
>
> I have spent some time with the profiler and performance monitor and it
> appears the the code is sound and without memory leaks. I have also gone
> thru to refactor poorly designed code and remove unnecessary nestings.
>
> So my initial questions with this admittedly somewhat vague problem
> are:
>
> 1.) Is there a way to turn off the animations and would doing so help
> with the speed?
> 2.) Has anyone else faced this same dilemma and how did you overcome
> the problems?
>
> Thanks,
> Adrian
>
>
>