Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I decrease startup and running time in .net applications?

I use C# to write windows applications with the .NET framework. How can I decrease startup time for these applications? My applications feel very slow during startup and initialization, particularly when showing the initial form.

My application works with an Access (MDB) database to save data. In some forms it loads data, but the first time the application shows any given form, it takes a long time to display.

I've tried using NGen to decrease the startup time, but it did not help me as expected.

like image 927
Hossein Moradinia Avatar asked Jul 04 '26 23:07

Hossein Moradinia


2 Answers

Make sure your application does as little work as possible on startup.

You can change your startup code to defer startup tasks to a secondary thread.

I'd give a more detailed answer, but your question is very broad and not detailed enough.

like image 122
Oded Avatar answered Jul 06 '26 13:07

Oded


First you need to diagnose what functions are running during this startup period, and analyze how much of the startup delay each of the functions is consuming...

Then once you know that, if one or two of them are consuming the bulk of the time, and do not involve the initially displayed UI screens, execute those functions on a separate thread.

like image 39
Charles Bretana Avatar answered Jul 06 '26 12:07

Charles Bretana



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!