Frans Bouma's blog

Generator.CreateCoolTool();

Syndication

News




    Add to Technorati Favorites

About me

Fun stuff I created

My work

.NET 2.0 GridView for winforms... why is it so slow?

Is it just me, or is the .NET 2.0 gridview control for Winforms about the slowest grid-like control that has ever been released? I mean, the painting of it is so incredibly slow, it hurts the eye.

In SqlServer 2005's management studio, open a table in Object explorer so you get a grid of rows. Open a table which has enough rows for a full screen. Then open a query window, which is effectively a new tab. Switch between the two by just clicking the tab headers. On my Xeon 3GHz box I see the painting done top to bottom on the grid which is taking at least half a second.

I noticed the same thing in a simple .NET 2.0 app with a Gridview on it. Other people have the same thing?

Published Saturday, October 29, 2005 12:20 PM by FransBouma

Filed under:

Comments

# re: .NET 2.0 GridView for winforms... why is it so slow?@ Saturday, October 29, 2005 1:14 PM

It most certainly is not just you. I was secretly hoping that the RTM version would be faster, but it's not. The old DataGrid control is probably an order of magnitude faster when it comes to repaint operations. This is a huge disappointment for me as I will have to continue to use a combination of Janus and Infragistics controls.

In addition, I miss the hierarchical capabilities of the old DataGrid control. Sure, it was done in a terrible way, but it was useful for prototyping.

Matthew Vandergrift

# re: .NET 2.0 GridView for winforms... why is it so slow?@ Saturday, October 29, 2005 2:18 PM

Not just you. I thought it might have been because I'm running beta 2 under VmWare.

Apparently not.

Kenneth Russo

# re: .NET 2.0 GridView for winforms... why is it so slow?@ Saturday, October 29, 2005 5:56 PM

The forgot to take the following statement out...

System.Threading.Thread.Sleep(500);

Wim Hollebrandse

# re: .NET 2.0 GridView for winforms... why is it so slow?@ Sunday, October 30, 2005 3:08 AM

Wim: heh :)

I had the same thoughts as you, Matthew, I also thought it was beta code and the final would be fast because, well, it would be the non-beta.

It's so incredibly slow, I have no idea what they're doing. Even with GDI painting in C# code you can't be this slow.

Later today I'll post an OldSkool Demoscene C# rotozoomer effect to show you how freaking fast .NET code can be, just for comparison.

Frans Bouma

# re: .NET 2.0 GridView for winforms... why is it so slow?@ Sunday, October 30, 2005 12:23 PM

Not only you ... same problem here, although I thought it was going to be faster on the final release (currently running RC1).

Yoeri

# re: .NET 2.0 GridView for winforms... why is it so slow?@ Sunday, October 30, 2005 3:59 PM

Its because along with the site weblogs.asp.net, Winforms is just another Microsoft unwanted stepchild.

Travis

# re: .NET 2.0 GridView for winforms... why is it so slow?@ Monday, October 31, 2005 3:34 AM

Travis, perhaps, perhaps not. They're really pushing WinForms again as SmartClients. Not every WinForm app is a smart client, but I really like SmartClients! Finally state again, and rich-client features. ;)

But as they're on their way with Avalon, you might be right as well. I've heard they didn't include a winform testing solution in VS2005/TS because Avalon is on its way.

Dennis van der Stelt

# re: .NET 2.0 GridView for winforms... why is it so slow?@ Tuesday, November 15, 2005 4:42 AM

The problem is, if they're not pushing Winforms because of Avalon, what are the people using Win2k and earlier going to do ?
We've got a fat client written in C++/MFC and we'd love to use .NET for productivity gains. However, Winforms seems so sluggish compared with C++ GUI frameworks, that it's difficult to justify using it.
At the moment we're looking into a number of alternatives

(a) wxWidgets using wx.NET. Seems to have a nice blindingly fast grid. Documentation sucks though, and there is always the worry that wx.NET will fade away. Lack of 3rd party controls.
(b) Gtk#. No grid widget, and documentation really sucks :) Also lack of 3rd party controls.

It beggars belief that MS couldn't have spent more time and effort with .NET2.0 to iron out the performance problems of Winforms/GDI+.

devdave

# re: .NET 2.0 GridView for winforms... why is it so slow?@ Thursday, November 17, 2005 11:32 AM

I think a great majority of users accustomed to Enterprise Manager is going to hate the new SQL Management Studio. When I first noticed this would be the replacement for EM I started posting about how this was a totally wrong approach, and was appalled at some of the responses from Microsoft. One I can remember quite vividly was: "...and now the SQL Client tools will get A FIRST-CLASS GRID...".

Juan Ignacio Gelos

# re: .NET 2.0 GridView for winforms... why is it so slow?@ Thursday, November 17, 2005 2:11 PM

Hey, this article was broght to my attention by a comment posted to my blog, and I wanted to get back to you directly.

We're sorry to hear you're seeing problems with performance. We're *very* interested to learn scenarios where we can improve, however we need hard data to make that happen. If you have a scenario you'd like us to take a look at, please repro steps and a project up to us at:

http://lab.msdn.microsoft.com/productfeedback/

Additionally there are forums up at
http://forums.microsoft.com/msdn/ for SQL and Windows Forms, they may be able to help you track down issues as well.

Jessica,
Developer, Windows Forms Team

JFo

# re: .NET 2.0 GridView for winforms... why is it so slow?@ Thursday, November 17, 2005 3:55 PM

Jessica, I already filed a bug some time ago:
http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=0ac37d78-964d-41d5-8b6c-07414253b047

I also mailed a repro program to the email address mentioned in that bugreport, it's been received and looked into, which opens with the same dataset data (2 instances so nothing interferes) 2 forms, one with the .NET 2.0 datagrid and one with the .NET 2.0 datagridview. You can clearly see the datagridview is very slow compared to the datagrid. If you want to receive the testprogram too, let me know :)

Frans Bouma

# re: .NET 2.0 GridView for winforms... why is it so slow?@ Thursday, November 17, 2005 9:17 PM

Cool, let's let that go through the normal process. I've double checked to make sure everything's on track. If you're having trouble, you can get to me through my contact link on my blog.

JFo

# re: .NET 2.0 GridView for winforms... why is it so slow?@ Friday, November 18, 2005 2:48 AM

Thanks Jessica :) I hope my repro will make sure the datagridview will render faster in the future, because of now I'll never use it in my applications because it makes .NET winforms apps so sluggish, and it's already the case winforms apps aren't the fastest in respect to user experience (the speed the user experiences). For example VB6 guis are much faster. Ok, they're native components but still...

Frans Bouma

# re: .NET 2.0 GridView for winforms... why is it so slow?@ Friday, November 18, 2005 5:13 AM

If you want examples and hard data of sluggish performance, just download some of the MS provided winform sample applications :)

http://www.windowsforms.net/Default.aspx?tabindex=4&tabid=49#WinForms%20V2%20Demo%20App

The Money Clone/Stock viewer example is particulary bad. If you show the datagridview (Trend View from the Choose a View combo), scrolling through it (moving the scroll thumb as opposed to mouse wheel) is painfully slow. Also selection is extremely slow. Try it. Select 20 rows and 2 columns. Now drag select more columns, you can see the selection highlight drawing itself row by row. Ok, maybe not that slow ;), but slow enough to have people comment when they see it.

Please don't misunderstand me, I love .NET and VS2005, I just find it frustrating that there is still visible ammunition available for MS detractors to steer people away from using Winforms. Pretty, modern UIs are great, as long as they're quick.

devdave

# re: .NET 2.0 GridView for winforms... why is it so slow?@ Friday, November 18, 2005 1:33 PM

Thanks devdave, I'll load that up.

JFo