Under what circumstances is Java faster than C ++?

Source: Internet
Author: User

Under what circumstances is Java faster than C ++?

Reviewer: Cameron Purdy, Senior Oracle middleware engineer.

This is based on what I learned more than 20 years after using C ++ and Java at the same time. In fact, using Java is a few years earlier than C ++:

1. Based on my experience, when you convert the optimized C ++ code into Java code, the code speed will be about three times slower.

2. Based on my experience, the speed of converting Java code into C ++ code is also three times slower. First of all, this comparison is meaningless unless you are aware of writing Java code in Java, rather than organizing C ++ code like the C ++ developer.

3. It is more efficient to use Java for concurrent data structures. When the data structure is not used concurrently, JVM eliminates the memory barrier and synchronization, and tends to use concurrent management based on runtime performance analysis.

4. Dynamic Memory Management in Java is often more efficient, especially in systems with excessive use of dynamic memory management and multithreading.

5. Java Inline code often performs better, unless you have performed a lot of Optimization on C ++ code based on analyzer or know exactly how to use inline to make C ++ more efficient ...... You will definitely fall in love with these header files !).

6. Large projects using Java are often easier to optimize, because JVM has made many "Global" optimizations for developers, such as inline dynamic loading of code capabilities ).

At least I feel like this ......

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.