Gerory
Gerory

Reputation: 31

Improve Application Performance

Want to Improvide Performance of C#.Net Application..

In my application I am using Third Party Interop/Dll To Process .doc Files.

It's a Simple Operation, Which Pass Input/Output FilePath to Interop dll ...& dll will execute text form input file.

To improve performance I have tried,

  1. Execute 2 therad to process 32 files.(each Thread process 16 files)
  2. Execute application code by creating 2 new AppDomains(each AppDomain Code process 16 files)
  3. Execute Code Using TPL(Task Parellel Library)

But all options take around same time (32 sec) to process 32 files. Manually process tooks same 32 sec to process 32 files.

Just tried one thing ..when I have created sample exe to process 16 files as input & output for reference Path given in TextBox.

..I open 2 exe instance to process. 1 exe has different 16 input files & output Created with input file path 2 exe has different 16 input files & output Created with input file path

When i click on start button of both exe ..it use 100% cpu & Utilize both core significantly & Process Completed within 16 sec for 32 files.

Can we provide this kind of explicit prallism to improve my application Peformance?

Upvotes: 3

Views: 226

Answers (2)

user180326
user180326

Reputation:

The problem could be that your third party tool is somehow synchronizing between threads. This could implicitly happen if it uses single threaded ("STA") COM components to do the work. You could verify this by breaking the app while running in the debugger and look at the call stacks for the worker and UI thread.

Upvotes: 0

Sam Holder
Sam Holder

Reputation: 32936

The way to go is to profile your application and see where it is spending its time. Then you can plan to optimise the bottlenecks. Trying to optimise without knowing where the slow part is is not the best use of your time as you are stabbing in the dark, hoping that something works. Find out where the issues are and address those directly.

There are several questions which recommend profilers. Check out this question and this question.

Upvotes: 1

Related Questions