We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

GDBG Perf..

Hi, pls look at the attached source code files.. specifically TestingGrid form. I have placed a GDBG control and binded to a defaultview of datatable that has 3 columns Name - string Status - int ImageIndex - int and the sorting order is based on status column arranged in descending order. for(int ctr=0;ctr<=15000;ctr++) { Dataset1.element1Row newRow = tbRow.NewRow() as Dataset1.element1Row; newRow.Name = "Name" +ctr.ToString(); newRow.Status = ctr; tbRow.Rows.Add(newRow); } ideally the above code will push the new row on top of grid... here is my observation... if i don''t bind the defaultview to grid and independely populate it it takes about 721 ms.. (it means dataview is pretty fast in arranging rows) but if i bind it to GDBG the population of rows in GDBG takes about 34 seconds... any thoughts ? i cannot upload any attachment to your server giving HTTP Exception...hence pasting the code.. gridDataBoundGrid1.DataSource = null; //Binding Code gridDataBoundGrid1.DataSource = dataset11.element1.DefaultView; DataView dsView = dataset11.element1.DefaultView; //Set the Sorting Order dsView.Sort = "Status DESC"; DateTime start,end; GridDataBoundGrid symbolGrid = gridDataBoundGrid1; symbolGrid.UseListChangedEvent=true; symbolGrid.ForceUpdateAfterListChangedEvent =false; symbolGrid.OptimizeInsertRemoveCells=true; symbolGrid.VerticalThumbTrack = true; symbolGrid.Binder.EnableAddNew=false; symbolGrid.Binder.EnableEdit=false; symbolGrid.Binder.EnableRemove=false; start = DateTime.Now; Dataset1.element1DataTable tbRow = dataset11.element1; symbolGrid.Binder.SuspendBinding(); for(int ctr=0;ctr<=15000;ctr++) { Dataset1.element1Row newRow = tbRow.NewRow() as Dataset1.element1Row; newRow.Name = "Name" +ctr.ToString(); newRow.Status = ctr; tbRow.Rows.Add(newRow); } symbolGrid.Binder.ResumeBinding(); end = DateTime.Now; TimeSpan diff = end-start; MessageBox.Show(diff.TotalMilliseconds.ToString()); Regards Yogesh S

4 Replies

AD Administrator Syncfusion Team February 11, 2005 08:26 PM UTC

Well, DataView is only fast as long as you don''t access any record. What is going on is when you bind the DataView to the grid and rearrange rows each time the DataView changes a ListChanged is raised. In the ListChanged handler the grid needs to know the contents of the record and accesses the dataview. When you access the DataView the whole DataView is being rebuilt. Just put a line like this: object obj = tbRow.Rows[someIndex); after adding the row and you will see what I am talking about. The DataTableWrapperList tries to work around this. But it is not working perfect, has some quirks. Stefan >Hi, > >pls look at the attached source code files.. specifically TestingGrid form. I have placed a GDBG control and binded to a defaultview of datatable that has 3 columns > >Name - string >Status - int >ImageIndex - int > >and the sorting order is based on status column arranged in descending order. > >for(int ctr=0;ctr<=15000;ctr++) >{ > Dataset1.element1Row newRow = tbRow.NewRow() as Dataset1.element1Row; > newRow.Name = "Name" +ctr.ToString(); > newRow.Status = ctr; > tbRow.Rows.Add(newRow); >} > >ideally the above code will push the new row on top of grid... > >here is my observation... > >if i don''t bind the defaultview to grid and independely populate it it takes about 721 ms.. (it means dataview is pretty fast in arranging rows) > >but if i bind it to GDBG the population of rows in GDBG takes about 34 seconds... > >any thoughts ? > >i cannot upload any attachment to your server giving HTTP Exception...hence pasting the code.. > >gridDataBoundGrid1.DataSource = null; > >//Binding Code >gridDataBoundGrid1.DataSource = dataset11.element1.DefaultView; >DataView dsView = dataset11.element1.DefaultView; > >//Set the Sorting Order >dsView.Sort = "Status DESC"; > > >DateTime start,end; >GridDataBoundGrid symbolGrid = gridDataBoundGrid1; >symbolGrid.UseListChangedEvent=true; >symbolGrid.ForceUpdateAfterListChangedEvent =false; >symbolGrid.OptimizeInsertRemoveCells=true; >symbolGrid.VerticalThumbTrack = true; >symbolGrid.Binder.EnableAddNew=false; >symbolGrid.Binder.EnableEdit=false; >symbolGrid.Binder.EnableRemove=false; > >start = DateTime.Now; >Dataset1.element1DataTable tbRow = dataset11.element1; >symbolGrid.Binder.SuspendBinding(); >for(int ctr=0;ctr<=15000;ctr++) >{ > Dataset1.element1Row newRow = tbRow.NewRow() as Dataset1.element1Row; > newRow.Name = "Name" +ctr.ToString(); > newRow.Status = ctr; > tbRow.Rows.Add(newRow); >} >symbolGrid.Binder.ResumeBinding(); >end = DateTime.Now; > >TimeSpan diff = end-start; >MessageBox.Show(diff.TotalMilliseconds.ToString()); > > >Regards >Yogesh S > >


AD Administrator Syncfusion Team February 11, 2005 08:53 PM UTC

Thx Stephen for enlightening me..u r correct a pin to dataview object inside loop brought the total execution time in par with actual grid population... any other solution you can think of ? i tried using DataTableWrapperList but it accepts a datatable.. how do i make it operate on a dataview... Thx once again for your help.. Regards Yogi >Well, DataView is only fast as long as you don''t access any record. > >What is going on is when you bind the DataView to the grid and rearrange rows each time the DataView changes a ListChanged is raised. In the ListChanged handler the grid needs to know the contents of the record and accesses the dataview. When you access the DataView the whole DataView is being rebuilt. > >Just put a line like this: > >object obj = tbRow.Rows[someIndex); > >after adding the row and you will see what I am talking about. > >The DataTableWrapperList tries to work around this. But it is not working perfect, has some quirks. > >Stefan > >>Hi, >> >>pls look at the attached source code files.. specifically TestingGrid form. I have placed a GDBG control and binded to a defaultview of datatable that has 3 columns >> >>Name - string >>Status - int >>ImageIndex - int >> >>and the sorting order is based on status column arranged in descending order. >> >>for(int ctr=0;ctr<=15000;ctr++) >>{ >> Dataset1.element1Row newRow = tbRow.NewRow() as Dataset1.element1Row; >> newRow.Name = "Name" +ctr.ToString(); >> newRow.Status = ctr; >> tbRow.Rows.Add(newRow); >>} >> >>ideally the above code will push the new row on top of grid... >> >>here is my observation... >> >>if i don''t bind the defaultview to grid and independely populate it it takes about 721 ms.. (it means dataview is pretty fast in arranging rows) >> >>but if i bind it to GDBG the population of rows in GDBG takes about 34 seconds... >> >>any thoughts ? >> >>i cannot upload any attachment to your server giving HTTP Exception...hence pasting the code.. >> >>gridDataBoundGrid1.DataSource = null; >> >>//Binding Code >>gridDataBoundGrid1.DataSource = dataset11.element1.DefaultView; >>DataView dsView = dataset11.element1.DefaultView; >> >>//Set the Sorting Order >>dsView.Sort = "Status DESC"; >> >> >>DateTime start,end; >>GridDataBoundGrid symbolGrid = gridDataBoundGrid1; >>symbolGrid.UseListChangedEvent=true; >>symbolGrid.ForceUpdateAfterListChangedEvent =false; >>symbolGrid.OptimizeInsertRemoveCells=true; >>symbolGrid.VerticalThumbTrack = true; >>symbolGrid.Binder.EnableAddNew=false; >>symbolGrid.Binder.EnableEdit=false; >>symbolGrid.Binder.EnableRemove=false; >> >>start = DateTime.Now; >>Dataset1.element1DataTable tbRow = dataset11.element1; >>symbolGrid.Binder.SuspendBinding(); >>for(int ctr=0;ctr<=15000;ctr++) >>{ >> Dataset1.element1Row newRow = tbRow.NewRow() as Dataset1.element1Row; >> newRow.Name = "Name" +ctr.ToString(); >> newRow.Status = ctr; >> tbRow.Rows.Add(newRow); >>} >>symbolGrid.Binder.ResumeBinding(); >>end = DateTime.Now; >> >>TimeSpan diff = end-start; >>MessageBox.Show(diff.TotalMilliseconds.ToString()); >> >> >>Regards >>Yogesh S >> >


AD Administrator Syncfusion Team February 11, 2005 09:02 PM UTC

Stephen.. no worries...even though in our real life environment we expect total number of rows to shoot up to max 7000-8000 rows..so not a big deal.. but surely we can apply one more optimization is to remove the sort order before populating bulk of rows and then re-apply the sort.. this works out like charm.. Thx once again for your support... Regards Yogesh S >Thx Stephen for enlightening me..u r correct a pin to dataview object inside loop brought the total execution time in par with actual grid population... any other solution you can think of ? i tried using DataTableWrapperList but it accepts a datatable.. how do i make it operate on a dataview... > >Thx once again for your help.. > >Regards >Yogi > > >>Well, DataView is only fast as long as you don''t access any record. >> >>What is going on is when you bind the DataView to the grid and rearrange rows each time the DataView changes a ListChanged is raised. In the ListChanged handler the grid needs to know the contents of the record and accesses the dataview. When you access the DataView the whole DataView is being rebuilt. >> >>Just put a line like this: >> >>object obj = tbRow.Rows[someIndex); >> >>after adding the row and you will see what I am talking about. >> >>The DataTableWrapperList tries to work around this. But it is not working perfect, has some quirks. >> >>Stefan >> >>>Hi, >>> >>>pls look at the attached source code files.. specifically TestingGrid form. I have placed a GDBG control and binded to a defaultview of datatable that has 3 columns >>> >>>Name - string >>>Status - int >>>ImageIndex - int >>> >>>and the sorting order is based on status column arranged in descending order. >>> >>>for(int ctr=0;ctr<=15000;ctr++) >>>{ >>> Dataset1.element1Row newRow = tbRow.NewRow() as Dataset1.element1Row; >>> newRow.Name = "Name" +ctr.ToString(); >>> newRow.Status = ctr; >>> tbRow.Rows.Add(newRow); >>>} >>> >>>ideally the above code will push the new row on top of grid... >>> >>>here is my observation... >>> >>>if i don''t bind the defaultview to grid and independely populate it it takes about 721 ms.. (it means dataview is pretty fast in arranging rows) >>> >>>but if i bind it to GDBG the population of rows in GDBG takes about 34 seconds... >>> >>>any thoughts ? >>> >>>i cannot upload any attachment to your server giving HTTP Exception...hence pasting the code.. >>> >>>gridDataBoundGrid1.DataSource = null; >>> >>>//Binding Code >>>gridDataBoundGrid1.DataSource = dataset11.element1.DefaultView; >>>DataView dsView = dataset11.element1.DefaultView; >>> >>>//Set the Sorting Order >>>dsView.Sort = "Status DESC"; >>> >>> >>>DateTime start,end; >>>GridDataBoundGrid symbolGrid = gridDataBoundGrid1; >>>symbolGrid.UseListChangedEvent=true; >>>symbolGrid.ForceUpdateAfterListChangedEvent =false; >>>symbolGrid.OptimizeInsertRemoveCells=true; >>>symbolGrid.VerticalThumbTrack = true; >>>symbolGrid.Binder.EnableAddNew=false; >>>symbolGrid.Binder.EnableEdit=false; >>>symbolGrid.Binder.EnableRemove=false; >>> >>>start = DateTime.Now; >>>Dataset1.element1DataTable tbRow = dataset11.element1; >>>symbolGrid.Binder.SuspendBinding(); >>>for(int ctr=0;ctr<=15000;ctr++) >>>{ >>> Dataset1.element1Row newRow = tbRow.NewRow() as Dataset1.element1Row; >>> newRow.Name = "Name" +ctr.ToString(); >>> newRow.Status = ctr; >>> tbRow.Rows.Add(newRow); >>>} >>>symbolGrid.Binder.ResumeBinding(); >>>end = DateTime.Now; >>> >>>TimeSpan diff = end-start; >>>MessageBox.Show(diff.TotalMilliseconds.ToString()); >>> >>> >>>Regards >>>Yogesh S >>> >>


AD Administrator Syncfusion Team February 11, 2005 09:11 PM UTC

Check out also GridModelDataBinder.SuspendBinding and ResumeBinding. Stefan

Loader.
Live Chat Icon For mobile
Up arrow icon