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
Goodepend on anything done inFoo? 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:
Foo, then launchFooin a separate threadGooand then runGoo(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
FooandGoo, 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.) IfFooandGooare 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.