High performance: DataGridView1.DataSource = MyDataTable (100,000 rows) [modified]
-
You're retrieving 100,000 rows and 8 to 9 seconds isn't fast enough for you?? Hint: Retrieve less rows! If you're not doing anything with ALL of those rows, there's no reason to retrieve them, now is there?
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
MyDataTable get data(rows) from Xml file not from database. If I use MyDataTable.DefaultView.RowFilter = "xxx", it will spent time for this process instead. 8 to 9 seconds is not fast enough for me. Is there any idea to improve performance?
-
MyDataTable get data(rows) from Xml file not from database. If I use MyDataTable.DefaultView.RowFilter = "xxx", it will spent time for this process instead. 8 to 9 seconds is not fast enough for me. Is there any idea to improve performance?
An XML file is a just a Text file. It takes a LONG time for the DataSet class to load AND PARSE that much stuff. 8 to 9 seconds for a file that big is GOOD. You simply have no choice but to break that file down into smaller chunks, organized how you want it filtered, then load only those files that you need. There is no other way to speed this up...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
An XML file is a just a Text file. It takes a LONG time for the DataSet class to load AND PARSE that much stuff. 8 to 9 seconds for a file that big is GOOD. You simply have no choice but to break that file down into smaller chunks, organized how you want it filtered, then load only those files that you need. There is no other way to speed this up...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007Dave Kreskowiak wrote:
8 to 9 seconds for a file that big is GOOD.
No kidding, especially for an XML file. Talk about bitching over spilled milk... If it is such a big deal, then he needs to refactor the problem into a smaller file like kubben recommended.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
-
You're retrieving 100,000 rows and 8 to 9 seconds isn't fast enough for you?? Hint: Retrieve less rows! If you're not doing anything with ALL of those rows, there's no reason to retrieve them, now is there?
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Dear, Sir and Madam How to improve performance for the code below? DataGridView1.DataSource = MyDataTable; //(MyDataTable contains 100,000 rows) The code above spent About 8-9 seconds that so long. Thank You. NOTE: WinForm not WebForm -- modified at 12:39 Wednesday 25th July, 2007
The DataGridView can be a pretty slow control to render large amounts of data, and as noted by others, it looks as if you're getting pretty good performnace. However, performance, and the illusion of performance are not quite the same thing. If your application looks as if it has hung during this 8-9 second load, then users might suspect it as having crashed. In which case, you might like to have this loading happening in a different thread, at least that way you can update the UI with a natty progress bar or similar. Taking this approach, however, may actually slow down the load - but the user will probably think it works more quickly than if the screen just locks up.
"It was the day before today.... I remember it like it was yesterday." -Moleman
-
8-9 seconds that I tell you not include Load AND PARSE Xml file. DateTime d1 = DateTime.Now; DataGridView1.DataSource = MyDataTable DateTime d2 = DateTime.Now; TimeSpan ts = d2 - d1; Console.WriteLine(ts); Thank You.
god4k wrote:
8-9 seconds that I tell you not include Load AND PARSE Xml file.
Then why did you say so?!?
god4k wrote:
DateTime d1 = DateTime.Now; DataGridView1.DataSource = MyDataTable DateTime d2 = DateTime.Now; TimeSpan ts = d2 - d1; Console.WriteLine(ts);
You're not seriously rendering 100,000 rows in a dataGrid, are you?? Is the user even going to look at all of that crap?? You really need to rethink your design, 'cause there is no way to speed up the rendering of 100,000. What does the user need to see?? That is all you should be showing them. I can't think of a single good reason to show a user 100,000 rows of a table...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Dear, Sir and Madam How to improve performance for the code below? DataGridView1.DataSource = MyDataTable; //(MyDataTable contains 100,000 rows) The code above spent About 8-9 seconds that so long. Thank You. NOTE: WinForm not WebForm -- modified at 12:39 Wednesday 25th July, 2007
Have you given a thought of using the Virtual mode in the Datagrid? GJ
-
8-9 seconds that I tell you not include Load AND PARSE Xml file. DateTime d1 = DateTime.Now; DataGridView1.DataSource = MyDataTable DateTime d2 = DateTime.Now; TimeSpan ts = d2 - d1; Console.WriteLine(ts); Thank You.
Cut the amount of data down as Dave has said. Only pull up the data that the user is going to be using at the moment, and 100,000 rows is not going to be the case. Allow the user to filter the rows he/she is going to need.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
-
Have you given a thought of using the Virtual mode in the Datagrid? GJ
Nice idea, but it's not a solution to the root cause of the problem - poor design.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Cut the amount of data down as Dave has said. Only pull up the data that the user is going to be using at the moment, and 100,000 rows is not going to be the case. Allow the user to filter the rows he/she is going to need.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
Why is it that no machine is fast enough for some "developers"??? :sigh:
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Why is it that no machine is fast enough for some "developers"??? :sigh:
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007No kidding. I've got a P4 running at 2.5ghz and 1gig ram. It fits the bill for my development projects. I even have test station boxes running between 233mhz and 1.8ghz :->
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon