It doesn’t matter if you add columns at run-time or not.  The main factor is 
how many column you are displaying and how many rows will be displayed.  And 
note that is different from the total set of columns that could be displayed 
and total number of data items:

Example:  I have a 10000 person database with 100 different statistics on each 
person.  I set up my DataGrid to have 100 columns representing each statistic, 
but because it won’t fit on the screen I set horizontalScrollPolicy=”true”.  
Still, the DG is likely to be full screen so it can show about 20 columns and 
30 rows.

Note that if do not set horizontalScrollPolicy=”true”, the DG will cram all 100 
columns on screen.  This makes a significant difference.  Instead of 20x30=600 
renderers, it is 100x30=3000 renderers.  The DG will take more than 5 times 
longer to set up and render 3000 renderers instead of 600 renderers, memory 
usage will go way up, and even things like mouse tracking and CPU utilization 
at idle time will be impacted.

The next important thing to remember is that DG has a very generalized update 
mechanism.  If it detects a change to any of the 10000 person records, it will 
refresh “all” of the renderers on the screen.  It does not optimize for whether 
that renderer is associated with that data item because labelFunctions and 
custom renderers make it possible for any data item change to affect every 
renderer.  This is very inefficient, but we have to be this conservative 
otherwise your renderers could miss updates.

This is important in how you setup and maintain your dataProvider.  A common 
mistake I see is to take some XML, make a new ArrayCollection, and loop through 
the XML creating Person records and using push/addItem to add it to the 
ArrayCollection.  Every time you do that, the AC generates a change event, and 
if the DG is already bound, it is going to try to refresh all of its renderers.

So, aggregate changes.  If you are converting XML, make an array, convert items 
and push them on the array and then set the whole array into the 
ArrayCollection’s source.

HTH,


On 3/22/10 4:28 PM, "fusionpage" <[email protected]> wrote:







Does anyone have any tips or tricks, in general, about optimizing the Flex 
client for best performance in populating/rendering large datasets in an 
AdvancedDataGrid?

I'm specifically NOT asking about improving the server-side.  I'm trying to 
understand what the factors are on the Flex client-side that impact how fast 
data loads/renders into an ADG, when the columns use in-line itemrenderers 
and/or the columns are added at run-time.

Are there any significant difference in performance when comparing different 
design patterns or ways of generating the datagrid? e.g. does it matter if it 
generated via pure AS3, or if you use MXML? Is performance the same no matter 
which design pattern one uses?

Assume the data is loading via a RemoteObject call.  In my case via a 
ColdFusion CFC.

Any tips, tricks, or links so I can learn more?

So, far, in my experience, most of the performance issues come from the 
server-side, but I may be ignorant on the impact of the design on the Flex side.

Thanks,
Don






--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui

Reply via email to