开发者

How should I optimize following requirement in my application. Dealing mainly with asp.net 3.5, C#, File I/O, Threading and some other aspects as well [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 8 years ago.

Improve this question

Scenario -

It is an simple application through which only single user ( NO Authentication Reqd.) uploads only excel 2003/2010 file one at a time and then two functions are called Foo() & Goo() one after other taking some data from that excel doing some string manipulation & numeric computation returning two different text files for same user to download.

Now开发者_如何转开发 my question is how can I optimize this. Performance has high preference. Also how can I use Threading between those two functions Foo() & Goo() ? Will that optimize my performance ? What more tips & tweaks are needed to achieve maximum speed in overall process.


Do the results of Goo depend on anything done in Foo? Do either of the methods actually change the data in the Excel document? Do they need to use the Excel object model other than to extract data to start with?

If not, you could:

  • Extract the data needed for Foo, then launch Foo in a separate thread
  • Extract the data needed for Goo and then run Goo (in the current thread, as it's already separate)

However, I would look at the existing performance characteristics of your code first - which bits actually take the most time? For example, if accessing the spreadsheet is taking more time than Foo and Goo, you won't get much benefit from the threading, and you'll certainly end up with more complicated code. (I think the Office COM objects are effectively single-threaded.) If Foo and Goo are the bottleneck, have you run a profiler on your existing code to see if you can make it faster without threading?

Do you have performance targets already? How close are you to meeting those targets? Don't bother trying to make the code as fast as it can possibly be, when you've already got it to run as fast as you need it to.


If Foo & Goo are not related, you could run them in two different threads making them run in parallel

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜