locked
VCConfiguration.PropertySheets VS2010 slow RRS feed

  • Question

  • Hi,

    In my add-in i need to access VCConfiguration.PropertySheets to check if a macro has been created and has the correct value, i need to do that for each of the project configurations.

    But my code was some how slow when testing with a 90 projects solution. I have do some profiling and access VCConfiguration.PropertySheets takes 14 ms on average, what seems very hight, in my test the PropertySheets has 5 items.

    foreach(VCConfiguration vcConfig in configurations)
    {
     IVCCollection sheets = (IVCCollection)vcConfig.PropertySheets; // 14 ms here
     VCPropertySheet newSheet = findPropertySheet(sheets, sheetName); // 0 ms
     if(newSheet == null)
     {
       newSheet = vcConfig.AddPropertySheet(propSheetFileName); // 0 ms
      }       
    }
    


    Any ideas to improve that code speed? any reason for that being so slow? That is with Visual Studio 2010
    Thursday, March 31, 2011 5:33 PM

Answers

  • Thanks for taking the time to look at this , i have review my code, and removed some unnecessary calls, that were removing and path from addtionalIncludeDirectories and later adding it again, the code is much faster now, is a bit strange that these calls that remove / re add the include dir were fast, and later read the property was much more slow, seems to me that i was clearing some kind of internal cache.

    Access to vcConfig.PropertySheets is still a bit slow for my add-in usage, but i can live with it, in VS 2010 i have cut the time a bit down , by only creating the sheet for the "Template" configurations instead creating it for each configuration.

    • Marked as answer by pepone.onrez Tuesday, April 5, 2011 10:38 PM
    Tuesday, April 5, 2011 10:37 PM

All replies

  • I have found that there are other things that are also very slow on VS 2010 compared to VS 2008

     

    VCCLCompilerTool tool = .....

    // That takes around 13 ms per call in vs 2010 7203 ms per 540 calls , in VS 2008 the time reported for 540 calls in 0 ms

     string additionalIncludeDirectories = tool.AdditionalIncludeDirectories;

    In my add-in i access VC++ configurations and check Includes, libs and environment , doing that for a solution with 90 projects take 0.3 seconds in VS 2008, in VS 2010 that is 26 seconds, what is very painfully as i need to that on the solution open event handler.


    Saturday, April 2, 2011 12:14 AM
  • Huge amounts of the VC++ stuff was rewritten in 2010 (which may account for the speed differences), also DTE itself was originally intended for use by scripting languages and speedy execution was never a design goal of it so perf is generally less than great. If you can use the raw service interfaces that DTE itself is likely using things would probably be much quicker, unless the slowness is in the underlying service layer.

    Ryan

    Saturday, April 2, 2011 12:24 AM
  • What are this raw interfaces? my add-in written in C# can i use the raw interfaces in C#?
    Monday, April 4, 2011 11:10 AM
  • Yes, by 'raw interfaces' I simply mean the IVsXXX type interfaces, that is all DTE (and MPF) are using under the covers, you can use them too. I looked at the VCConfiguration bits....it is rather complex how they go about returning these values, certainly out of my depth. I can point a project system dev over here, maybe they would have better advice.  14 ms may not be terribly long looking at all the stuff it is doing, though if you are doing it hundreds of times it certainly adds up.

    Ryan

    Monday, April 4, 2011 4:38 PM
  • Thanks for taking the time to look at this , i have review my code, and removed some unnecessary calls, that were removing and path from addtionalIncludeDirectories and later adding it again, the code is much faster now, is a bit strange that these calls that remove / re add the include dir were fast, and later read the property was much more slow, seems to me that i was clearing some kind of internal cache.

    Access to vcConfig.PropertySheets is still a bit slow for my add-in usage, but i can live with it, in VS 2010 i have cut the time a bit down , by only creating the sheet for the "Template" configurations instead creating it for each configuration.

    • Marked as answer by pepone.onrez Tuesday, April 5, 2011 10:38 PM
    Tuesday, April 5, 2011 10:37 PM