Performance Issues With Report Control |
Post Reply |
Author | |
ericchubb
Groupie Joined: 31 May 2010 Location: Ireland Status: Offline Points: 15 |
Post Options
Thanks(0)
Posted: 10 July 2012 at 1:57pm |
Hi there
I'm working with an MFC application that contains a ReportControl. This control can be expected to contain several thousand rows at one time and one of the requirements is that all rows and their children be expanded upon creation. The code I use to do this is a recursive function which starts at the top level rows and traverses their children and their children and so on and so on. void CReportControlEx::ExpandRows(CXTPReportRows* pRows) { const int nRowCount(pRows->GetCount()); for(int nRowIndex=0; nRowIndex < nRowCount; nRowIndex++) { CXTPReportRow* pRow = pRows->GetAt(nRowIndex); pRow->SetExpanded(TRUE); CXTPReportRows* pChildRows = pRow->GetChilds(); ExpandRows(pChildRows); } } Having profiled our application, this turns out to be quite a time consuming process taking upwards of 20 seconds for 8000 rows on my development machine, because the rows are being expanded in a way that is dictated by the row hierarchy. The overhead in my code it seems is due to the sheer number of recursive function calls being made, with the subsequent invocations of GetChilds(), GetCount() whose performance I can't evaluate. I tried using the functions SetFullExpanded or SetExpanded(TRUE,TRUE) provided by the CXTPReportRow class, but these take about four times as long to complete as my code, with no discernible difference in effect. I'm wondering (a) why SetFullExpanded and SetExpanded (TRUE, TRUE) are so slow? (b) if there is a better way than the method I'm using to expand the rows i.e. a way to get all the rows as a flat data structure like a linked list rather than a B-Tree like structure they seem to be today, with the result I can just loop through all the rows without caring about parent-child relationships and recursing thousands of times? Thanks a lot Eric |
|
Eric
Product: Xtreme Toolkit Version 22.0 Platform: Windows 11 (64bit) - Language: Visual C++ 2022 /C# .NET 2/3.5/4/5/6/7 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |