Against: GUI applications are slow
Posted by:
Tim (---.gotadsl.co.uk)
Date: Wednesday, 22-Sep-2004, 22:19:18
Windows Forms applications are typically less snappy than Win32 applications. As I understand it, part of the reason is that the drawing library uses GDI+, which does not benefit from the same acceleration as GDI in typical video drivers. There must be other factors too.
A while back someone coded an application to test the performance of various languages/compilers. C# and VB.NET came out very badly, and I took a look at the code. The application simulated various elements by drawing the movement of atoms on the screen, and most of the time was spent in the drawing routines. On one example element, the original code was drawing about 350 frames per second on my system. I tweaked the code to use PInvoke to GDI for the performance-critical drawing routines, and the performance increased to around 4500 fames per second. It's an astonishing difference, and simultaneously shows how slow .NET drawing can be, and how you can keep your application in C# but dramatically speed performance with judicious use of a few PInvoke calls.