Solved

FileVersionInfo.GetVersionInfo ().ProductVersion performance

Posted on 2003-10-22
3
1,154 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 28

Assisted Solution

by:iboutchkine
iboutchkine earned 63 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 63 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

739 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