Let's talk about the running efficiency of managed code in a general sense.

Source: Internet
Author: User

Everyone knows that C is faster than C ++ and C ++ is faster than C.
The problem is the speed.

The specific speed should not be general. What kind of operations should be faster, it is further divided into some special situations such as cold start, hot start, running, multi-run average, peak, and resource restriction. In these cases, we will test, analyze, and explain them here.

Microsoft claims that. NET is about 90% of the execution efficiency of C/C ++. XNA provides materials to claim that the efficiency of Managed DirectX can reach 98% of that of Native DirectX.

In an unofficial test, the performance of C # can reach 70%-80% of C ++ in general applications.
As the hosting code, this is a good result.

I/O operations C # should not be lost in C ++.
It must be C> C ++> C # In numerical calculation #
The operating memory is also C/C ++> C #
Many people may be surprised that, without special optimization, File Operations C # may be faster than C/C ++.

I'm quite satisfied with the result.

If you develop a real-time system, host the code (. net/Java) is indeed a weakness, but in most cases, hosting code is very acceptable if the system is not real-time and the resources are not strictly limited.

Note that there are three prerequisites:

  • Non-Real-Time
  • Resources are not strictly limited
  • Generally

Moreover, the system performance can be further improved through better system architecture, more reasonable process design, and better algorithms. These improvements may be more than 20% or 30%, double growth is not impossible.

  • The majority of C # programs written by most programmers are easier to write than the majority of C/C ++ programs written by most programmers;
  • The majority of C/C ++ programs written by most programmers are easier to crash than the majority of C # programs written by most programmers.

Think about why.

In the history of computer programming language development, the lowest-level programming language emerged first, and more advanced programming languages emerged. One of the reasons is that computing devices are getting cheaper and more powerful. There are many other reasons, such as the reasons for software engineering and the explosive growth of people's demand for IT services, these are also extremely important reasons. The development of computer programming language seeks a balance among these many reasons. This balance cannot even be achieved for all fields, but only for some specific fields.

Everyone can understand this truth.

However, some people may not understand the specific programming language and begin to commit an issue. A little funny.

You may have read some detailed evaluation articles. These articles may have different conclusions due to the different testing methods and environments, however, reading such articles is not just a simple conclusion. It depends on its testing methods and scenarios to get some useful information for you.

References:

  • Benchmark start-up and system performance for. net, Mono, Java, C ++ and their respective uihttp: // www.codeproject.com/articles/92812/benchmark-start-up-and-system-performance-for-net
  • [Mono-list] mono C # versus Java 6-server performance
    Http://lists.ximian.com/pipermail/mono-list/2007-November/037091.html
  • C #, C ++, Java Performance Comparison
    Http://www.cppblog.com/Chipset/archive/2009/03/01/75266.html
  • Application Performance: C # vs C/C ++
    Http://www.cnblogs.com/skyivben/archive/2008/07/02/1234335.html
  • Detailed evaluation of C # and C/C ++ performance comparison, see who is better?
    Http://www.xueit.com/cshare/show-7142-1.aspx
  • C # vs C/C ++ Performance
    Http://www.codeproject.com/Articles/24045/C-vs-C-C-Performance
  • Stream I/O Performance
    Http://www.cnblogs.com/slime/archive/2009/11/11/1600601.html
  • Improving. NET Application Performance and Scalability
    Http://msdn.microsoft.com/zh-cn/library/ff649152.aspx
  • . NET Performance Testing and Optimization-The Complete Guide

    Http://book.douban.com/subject/4912580/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.