Use the performance profiler to see if you can find places to optimize.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: [email protected] [mailto:[email protected]] On Behalf 
Of sharath reddy
Sent: Tuesday, January 05, 2010 1:58 PM
To: [email protected]
Subject: [flexcoders] Performance issues with data grid/advanced data grid



Hi All,

I'm loading an AdvancedDataGrid with an ArrayCollection of about 1350 items 
retrieved from the server. Each record has 5 fields, and I am using one very 
simple custom renderer. The grid doesn't seem to be able to handle these many 
records, and throws the following error:

Error #1502: A script has executed for longer than the default
timeout period of 15 seconds.

(I have attached the full stack trace at the end of the email)

I replaced ADG with the regular data grid, and experienced the same problem.

If I 'slice' the ArrayCollection and add only the first 1000 records, it seems 
to work (after some delay). The optimum performance seems to be with about 300 
records. I found a couple of work-arounds:

1. Currently, I set the height of the grid to be equal to the number of rows 
returned from the server. Scrollbars are turned off on the grid and turned on 
for the VBox that contains the grid.

If I set a fixed height for the data grid and turn ON the vertical scrollbars, 
the data renders correctly. I'm guessing that this allows the data grid to 
re-cycle renderers while scrolling and leads to more efficient performance. 
However, I don't want scrollbars on the grid, only on the parent container.

2. I can develop a paging implementation of the data grid, displaying about 500 
records on each page. Again, I would rather not do this.

Sorry for the long-winded post, any suggestions/workarounds to tackle this 
issue? Thanks for your help!

Sharath

Full Stack trace of the exception:

Error: Error #1502: A script has executed for longer than the default
timeout period of 15 seconds.
at
mx.managers.layoutClasses::PriorityQueue/removeLargestChild()[C:\autobuild\3.2.0
\frameworks\projects\framework\src\mx\managers\layoutClasses\PriorityQueue.as:145]
at mx.managers::LayoutManager/validateClient()[C:\autobuild\3.2.0
\frameworks\projects\framework\src\mx\managers\LayoutManager.as:940]
at mx.core::UIComponent/validateNow()[C:\autobuild\3.2.0
\frameworks\projects\framework\src\mx\core\UIComponent.as:5679]
at
mx.controls.dataGridClasses::DataGridBase/updateRendererDisplayList()[C:\autobuild\3.2.0
\frameworks\projects\framework\src\mx\controls\dataGridClasses\DataGridBase.as:1184]
at
mx.controls.dataGridClasses::DataGridBase/drawItem()[C:\autobuild\3.2.0
\frameworks\projects\framework\src\mx\controls\dataGridClasses\DataGridBase.as:1154]
at
mx.controls.dataGridClasses::DataGridBase/drawVisibleItem()[C:\autobuild\3.2.0
\frameworks\projects\framework\src\mx\controls\dataGridClasses\DataGridBase.as:1127]
at
mx.controls.dataGridClasses::DataGridBase/makeRows()[C:\autobuild\3.2.0
\frameworks\projects\framework\src\mx\controls\dataGridClasses\DataGridBase.as:708]
at
mx.controls.dataGridClasses::DataGridBase/makeRowsAndColumns()[C:\autobuild\3.2.0
\frameworks\projects\framework\src\mx\controls\dataGridClasses\DataGridBase.as:593]
at mx.controls::DataGrid/makeRowsAndColumns()[C:\autobuild\3.2.0
\frameworks\projects\framework\src\mx\controls\DataGrid.as:1538]
at
mx.controls.listClasses::ListBase/makeRowsAndColumnsWithExtraRows()[C:\autobuild\3.2.0
\frameworks\projects\framework\src\mx\controls\listClasses\ListBase.as:1360]
at
mx.controls.listClasses::ListBase/updateDisplayList()[C:\autobuild\3.2.0
\frameworks\projects\framework\src\mx\controls\listClasses\ListBase.as:3658]
at
mx.controls.dataGridClasses::DataGridBase/updateDisplayList()[C:\autobuild\3.2.0
\frameworks\projects\framework\src\mx\controls\dataGridClasses\DataGridBase.as:581]
at mx.controls::DataGrid/updateDisplayList()[C:\autobuild\3.2.0
\frameworks\projects\framework\src\mx\controls\DataGrid.as:1437]
at
mx.controls.listClasses::ListBase/validateDisplayList()[C:\autobuild\3.2.0
\frameworks\projects\framework\src\mx\controls\listClasses\ListBase.as:3280]
at
mx.managers::LayoutManager/validateDisplayList()[C:\autobuild\3.2.0
\frameworks\projects\framework\src\mx\managers\LayoutManager.as:622]
at
mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0
\frameworks\projects\framework\src\mx\managers\LayoutManager.as:695]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0
\frameworks\projects\framework\src\mx\core\UIComponent.as:8628]
at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0
\frameworks\projects\framework\src\mx\core\UIComponent.as:8568]

Reply via email to