Bug 520530

Summary: MonthCalendar: performance is affected by our Bridge
Product: [Mono] UI Automation Reporter: calen chen <cachen>
Component: Winforms - GeneralAssignee: E-mail List <mono-a11y-bugs>
Status: NEW --- QA Contact: E-mail List <mono-a11y-qa>
Severity: Normal    
Priority: P5 - None    
Version: Release 1.0   
Target Milestone: ---   
Hardware: x86   
OS: openSUSE 11.1   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description calen chen 2009-07-09 08:37:08 UTC
PROBLEM STATEMENT:

This sample has gave CalendarDimensions property showing 6 month on the form,
once click the Preview/Back push button that all widgets will be rebuild again, so user will see the calendar is refrashed slowly in sample GUI that the performance is affected much. but if doing "export MONO_UIA_BRIDGE='ABC'"( not use our Bridge), then run the sample again and click Pre/Back button, you will see the calendar is refrashed quickly 

REPRO:

1. run the attachment sample, click Preview/Back push button

2. run "export MONO_UIA_BRIDGE='ABC'", then run the attachment sample, then click Preview/Back push button

RESULTS:

step1: Calendar is refrashed slowly

step2: Calendar is refrashed quickly

EXPECTED RESULTS:

expect mono uia bridge doesn't affect the performance so much!
Comment 1 Rui Guo 2009-07-13 08:38:38 UTC
Some profiling data (in a 768MB memory vmware, 1.9G Core 2 CPU):

If we set a MonthCalendar with CalendarDimensions = new Size(4,3)

and then click the prev month button, we will wait about 16 seconds to see the result.
about 6 seconds is consumed by RemoveChildren in MonthCalendarDataGridProvider.OnDateChanged,

about 9 seconds is consumed by AddChildren in 
MonthCalendarDataGridProvider.OnDateChanged,
and about the 9 seconds, in AddChildren:

		private void AddChildren ()
		{
			MonthCalendarListItemProvider item;
			SelectionRange range = calendar.GetDisplayRange (false);

			for (DateTime d = range.Start;
			     d <= range.End; d = d.AddDays (1)) {
				int days = (d - range.Start).Days;
				int r = (int)System.Math.Floor ((double)days
					/ (double)MonthCalendarProvider.DaysInWeek);
				int c = days - (r * MonthCalendarProvider.DaysInWeek);
				item = new MonthCalendarListItemProvider (
					this, calendarProvider, Control, d, r, c); //Line #A
				item.Initialize (); //Line #B
				AddChildProvider (false, item); //Line #C
				gridChildren.Add (d, item);
			}
			...
		}


Line A took 1 seconds, Line B took 3.5 seconds, Line C took 4.5 seconds. other lines of code took nearly no time.