Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

FileVersionInfo.GetVersionInfo ().ProductVersion performance

Posted on 2003-10-22
3
Medium Priority
?
1,167 Views
Last Modified: 2010-05-18
I have an app that calls FileVersionInfo.GetVersionInfo (<filename>).ProductVersion for all the files in a folder (90 files total).  

After rebooting my PC, the first time I run this app, the 90 calls take 5 seconds.  The second time they take .2 seconds.   Can anyone explain the performance difference.  Obviously something has been cached, but what?

The reason I'm asking is that our users turn on their PC in the morning, start this app and leave it running all day.  I'm trying to improve the startup performance of the app.
0
Comment
Question by:wile_e_coyote
3 Comments
 
LVL 28

Assisted Solution

by:iboutchkine
iboutchkine earned 189 total points
ID: 9600204
When you run the app the first time CLR under .NET Framework compiles the piece of code that you are running. THe second time if compilation was done before CLR does not do it. The more you will run your app under .NET Framework, the faster it will run up to the point where everything is compiled. The first time is the slowest
0
 
LVL 41

Accepted Solution

by:
graye earned 189 total points
ID: 9606164
yes, it could be the "just-in-time" compiler that's causing the effect.  But if so, that would only apply to very first time.  

On the other hand, it might just be the File System cache that's doing the trick...  files are cached up after the first run, making subsequent runs go much faster.

But let's talk about optimization...

You can use the FileSystemInfo object to pull all the "directory" information of the files in a folder into an array with a single call.  This *might* prime the pump to make calls to FileVersionInfo go faster (I haven't tried it)
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 23258867
I had the same effect in native Win32 code. It must be caused by the underlying Windows API.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question