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
Solved

FileVersionInfo.GetVersionInfo ().ProductVersion performance

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

856 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