Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Performance Issues With Report Control
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Performance Issues With Report Control

 Post Reply Post Reply
Author
Message
ericchubb View Drop Down
Groupie
Groupie


Joined: 31 May 2010
Location: Ireland
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote ericchubb Quote  Post ReplyReply Direct Link To This Post Topic: Performance Issues With Report Control
    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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.