Win32 vs .Net performance



I am not trying to smack a hornets nest, but is there any way to achieve
near-Win32 performance from .Net apps?

I'm porting a VB6 app to .Net and the difference in performance is notable.
I'm using 3rd party controls from the same vendor and have trimmed as much
"fat" from them as possible. Granted, there is functionality with the .Net
controls that doesn't exist in the COM versions, but even with the "canned"
controls, the difference can be seen.

Rest assured, I'm playing by all of the OO (& MS for that matter) guidelines
in the re-write, custom objects, stored procedures for nearly everything,
limited amounts of data and a properly indexed database.

Can anyone offer any tips for increasing performance with .Net windows forms
apps? I'm considering migrating to Delphi since Borland still supports the
Win32 platform.

Sadly, it appears the runtime for Winforms performance is coming to that of
Java runtime and Swing.




I come from a long line of hardcore development(15+ years) (x86/68000 ASM,
C/C+ realtime controls and even live streaming). Without knowing
specifically what/where you are trying to improve (performance), below is my
stab at your problem.

Oviously, .NET comes with much overhead. MS have done an amazing job with
the JIT to create native code and improve performance. Nonetheless,
abstraction comes with a price.

Currently, I use .NET 2005 for most of our solutions. Below are some things
you can look at.

1. Indentify your bottle neck and improve it (spot check).
2. Minimize reflection usage.
3. Use threadpool instead of launching your own thread when multithreading.
4. When multi-threading consider context switching when determining number
of threads.

What I've found is that most performance problems are usually confined to
small section of codes. Identify those and you should be able to resolve
most if not all of your problems.

Good luck.


Hi Morgan,

I too have a VB5/VB6 background, but the last 3 years I have spent most of
my time programming in VB.NET, and except for the loading of Forms, which
seems to be (much) slower, my experience is that the overall performance of
..NET applications is much better than VB6.

Of course I cannot tell you what the problem is in your application, but
sometimes what I have done to improve the user experience for slowly loading
forms, is to just display the form without loading data in the Form_Load
event, but start a timer instead (20 milliseconds for example) and then load
the data when the timer elapses. This gives .NET plenty of time to draw the
form faster and it looks nicer.

Hope this helps,


Claes Bergefall

Where are you getting performance problems? Only thing I've experienced is
that graphics rendering is slow. Everything else seems to be just as quick
as in plain Win32 code.

That graphics is slow is because a bunch of stuff in .NET uses GDI+ and it
doesn't support hardware acceleration (yet). Hopefully that will be
supported in the near future.


Morgan Fears

Thanks all for your feedback, I appreciate it.

The app involved is a client/server app(hiss.. word from the 90's ;) ). The
most used form is "heavy", it has a tab sheet and 3 Infragistics grids on
it. Trying to follow all of the OO purists & MS guidelines, the performance
just didn't pan out. I moved from custom objects to straight DataTable binding
and the performance got better. I'm not faulting the Infragistics grid because
the customer loves the functionality, or the Framework, but I guess you get
to a point where you have to go with what works best and in this case it's
databinding to datasets/datatables.

Thanks again,


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question