Google:c++, Java, Scala, go four languages performance comparison

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Google released a research report that carefully compared C + + , Java , Scala and Google's own Go the performance of the programming language.

According to Google's Test report ( PDF format), C + + is the fastest in four languages. but the document also points out that it is relatively difficult to optimize the code, which requires considerable effort and proficiency, not the average level of programmers can achieve.

GoThe aim is to eliminate at least some of this limitation, but it is still young (it debuts for about a year, but the first half of the year is just an "experimental" language), and in most Google tests it shows that it lags behindC + +as wellJavaand theScala. "Goprovides interesting language features: This is a concise and standardized symbol, "read the report,GOOGLEfounder Robert Hent wrote: "[but]The language compiler is still immature: the problem is reflected both in performance and in binary size. "

This means thatGocompilation is faster than the other three languages. Javaand theScalacompiled intoJavabyte code, andC + +and theGocompiled into machine code. Google is currently not testing concurrency: aScalaand theGoareas of particular concern. Gois designed as a concurrency language that providesC + +the speed, but "feel" likePythonDynamic Language.

Scala--Athe language between object-oriented programming and process language, running inJavarunning on the virtual machine-edgeJava, and it has a smaller code and memory space. but it's still subject to some restrictionsJavathe. from the report, see: "Scala[of the]concise symbolic language and powerful code optimization features, the best choice for heavy complexity ""JavaThe version is probably the easiest to implement, but the most difficult performance analysis. Specifically, the effects of garbage collection are complex and very difficult to tune around. BecauseScalain theJVMhave the same problem on the run.

and the report published on the Register, at a reception in Silicon Valley in Friday, Scala founder of Martin Odersky approved of his stamp, Google's benchmark, operates on two different levels.

first, the Google code for each language, using the language of the idiomatic container class benchmark, loop structure, and memory / Object Allocation Plan--no language is used, designed to maximize the performance of specific tools. "This approach allows for the language features, code complexity, compiler and compile-time, binary size, run time and memory footprint almost fair comparison," said the file.

After testing the results in Google's announcement, various Google engineers optimized each language benchmark and ran the tests again. "While this work is a comparative anecdote only, benchmarks, as well as subsequent adjustment efforts, are indicative of pain points in the typical performance of their respective languages," Hunter said.

Oderskyagree, at least in relation toScala. optimized-This involvesScalaadvantages in terms of functionality--Scalasignificantly reduces the size of the code and its run-time. "I particularly like the idea of building an algorithm for an angle non-professional point, by comparing the data, and then...and then challenge people to optimize, "Oderskysaid. "In a sense, it is fair. "

During the optimization phase also shows , while c + + Provides the fastest running time, optimizing code is more difficult. In the optimization phase, developers also significantly reduced the c size + binary file.

google employee Ian travels to Lanstelle in the mailing list, rarely transfers work to optimization before the release of the file, and now, after further optimization, the code is much faster. "Despite the name, < Span style= "Font-family:calibri" >[ surface go to optimized version code never intended to be an authentic or efficient travel. Robert [ Hunter ] example let me take a look at his code. , and one more look, I cut dead for one hours to do a little better. If I had realised that he was going to release it, I would have made it a better place to devote more time, "Taylor said.

but scala said odersky "I know, we are head to the java head. It's a surprise that we're all better than java

Related Article

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.