CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    May 2009
    Posts
    92

    Difference in performance between CSharp and C++

    Is there any difference in performance between CSharp and C++ if I am writing network programming in these two language??

  2. #2
    Join Date
    May 2007
    Posts
    1,546

    Re: Difference in performance between CSharp and C++

    Yes. There's also a difference between two apps written in C++.

    Will you notice or care? An educated guess would say "probably not".
    www.monotorrent.com For all your .NET bittorrent needs

    NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.

  3. #3
    Join Date
    Mar 2008
    Location
    IRAN
    Posts
    811

    Re: Difference in performance between CSharp and C++

    for me this feature that c++ allows default arguments on function parameters is good also.
    Please rate my post if it was helpful for you.
    Java, C#, C++, PHP, ASP.NET
    SQL Server, MySQL
    DirectX
    MATH
    Touraj Ebrahimi
    [toraj_e] [at] [yahoo] [dot] [com]

  4. #4
    Join Date
    May 2009
    Location
    Bengaluru, India
    Posts
    460

    Re: Difference in performance between CSharp and C++

    I think C++ is more faster in performance than C# as it does not contain more graphics and other framework libraries that .NET provide you...

  5. #5
    Join Date
    May 2007
    Posts
    1,546

    Re: Difference in performance between CSharp and C++

    Quote Originally Posted by vcdebugger View Post
    I think C++ is more faster in performance than C# as it does not contain more graphics and other framework libraries that .NET provide you...
    The quantity of pre-written libraries which are available to use has no affect on performance.

    http://blogs.msdn.com/ricom/archive/...10/416151.aspx

    Read the entire article. It's an implementation of a chinese-english dictionary in C++ and C#. C# gave better performance for a *lot* less coding effort. After serious (unmaintainable) optimisations were applied to the C++ version, it was able to complete the task in 80ms whereas the initial C# version completed in 120ms or so. The slightly optimised C# version could complete the task in < 100ms.

    Moral of the story. No single language is 'fastest'. It all depends on the algorithms you use.
    www.monotorrent.com For all your .NET bittorrent needs

    NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.

  6. #6
    Join Date
    May 2007
    Location
    Denmark
    Posts
    623

    Re: Difference in performance between CSharp and C++

    It's like asking "which car is better". The end result will always come down to the driver
    It's not a bug, it's a feature!

  7. #7
    Join Date
    May 2007
    Posts
    1,546

    Re: Difference in performance between CSharp and C++

    Quote Originally Posted by foamy View Post
    It's like asking "which car is better". The end result will always come down to the driver
    That's a much better way of putting it
    www.monotorrent.com For all your .NET bittorrent needs

    NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.

  8. #8
    Join Date
    Jun 2008
    Posts
    2,477

    Re: Difference in performance between CSharp and C++

    Just as an aside...

    C# apps will always have a slightly longer startup time, but the JIT compiler can apply optimizations for the machine that the application is currently being run on. The C++ compiler has to be far more general because it compiles the program to native code, so it has to run (practically) anywhere. Like the others have said, anyone who says something like "C++ is faster than C#" doesn't know what they are talking about, and in your case it would likely not even matter if one were slightly faster than the other.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured