Print Page | Close Window

Performance Issues With Report Control

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=19937
Printed Date: 16 June 2024 at 8:09pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Performance Issues With Report Control
Posted By: ericchubb
Subject: Performance Issues With Report Control
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net