Solved

FileVersionInfo.GetVersionInfo ().ProductVersion performance

Posted on 2003-10-22
3
1,147 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 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Unable  to create new object 9 38
Getting multiple values from a dataset ASP.NET(VB) 3 37
SlingPlayer alternatives 1 28
Export import database 4 39
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

947 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now