Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 330121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:39:07+00:00 2026-05-12T09:39:07+00:00

I am creating an extension for Visual Studio 2008, and because I didn’t want

  • 0

I am creating an extension for Visual Studio 2008, and because I didn’t want to write my own parser for C++ (I’m not masochistic) I am using VCCodeModel.

Getting a simple field from these COM objects takes orders of magnitude more time than any of the other operations I am doing, and since I am drilling down to the method level of very large C++ projects I have this inefficiency at the lowest levels of my recursion.

   vcCodeBaseFunctions = ((Microsoft.VisualStudio.VCCodeModel.VCCodeElements)
                                (vcCM.Functions));
   int i = 0;
   for (i = 1; i <= vcCodeBaseFunctions.Count; i++)
   {
     if (vcCodeBaseFunctions.Item(i).Kind == vsCMElement.vsCMElementFunction)
                parent.AppendChild(MethodWrapper.VCCodeFunctionToXML(
                          (VCCodeFunction)vcCodeBaseFunctions.Item(i)));
   }

The preceding code would iterate through all of the functions at the base level of a project, convert them to XML and then save them. The XML method would call multiple fields inside the VCCodeFunction like name, parameters, etc.

Is managed C++ faster than C# for this purpose? I have an inadequate understanding of how the back end of managed C++ is different than C#, but my intuition would lead me to believe that there is less of a “context switch” cost between managed and unmanaged code in C++, but am I wrong? I am getting a good bit of slowdown from what I believe is switching repeatedly between managed and unmanaged code in C++ using CodeModel, so am I correct in assuming that managed C++ would be faster?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T09:39:07+00:00Added an answer on May 12, 2026 at 9:39 am

    There is an overhead with the COM interop layer in .NET. If you were to use C++, you could move your COM access into native code, which would speed up that section of the code access.

    However, you’re still going to have native->managed interop at some point, if you’re planning to use C++/CLI. Somewhere in the chain, you’ll be marshalling data across, although you may be a bit faster if you can move this outside of these loops (if you make your recursion 100% native, you’d have far fewer interop calls).

    That being said, the VCCodeModel is not particularly fast – Although I agree that your getting some overhead with the COM interop, be aware that the profiler you’re using may be exaggerating this. This is particularly true if you’re using a tracing profiler, as you’re going to be spending more time in those calls during profiling than during an actual release run. Profilers aren’t perfect, and this may be a case where you’re getting skewed results due to your profiler.

    I suspect that your potential speed gains would not merit a port – although it would be difficult to know for sure without more information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a shell extension in C++ (ATL 9) using Visual Studio 2008.
I'm creating an IE extension in C# using visual studio 2010. How do I
I 'm writing a Visual Studio extension where I'm creating line adornments that need
I am having trouble creating a new edmx file using Visual Studio 2011 beta
When creating a new extension for visual studio, there are two project options: Visual
I am creating a small Visual Studio 2010 extension in C# which uses the
I've had not a lot of luck creating a WCF service with Visual Studio.
After compiling my own php extension using VC9 (2008) and VC10 (2010) using the
Currently i am creating an extension method that accepts parameters. Using the below example,
I am creating a firefox extension. I want to get the URL of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.