Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1785730
  • 博文数量: 413
  • 博客积分: 8399
  • 博客等级: 中将
  • 技术积分: 4325
  • 用 户 组: 普通用户
  • 注册时间: 2011-06-09 10:44
文章分类

全部博文(413)

文章存档

2015年(1)

2014年(18)

2013年(39)

2012年(163)

2011年(192)

分类: C/C++

2011-12-14 19:55:44

Google Publishes C++, Go, Java and Scala Performance Benchmarks

Google has published a paper (PDF) comparing performance of four programming languages, C++, its own language Go, Java and Scala. A team at Google created a "simple and compact" benchmark that didn't take advantage of language-specific features. An algorithm was implemented using each language's "idiomatic container classes, looping constructs, and memory/object allocation schemes."

However, the paper notes: "While the benchmark itself is simple and compact, it employs many language features, in particular, higher-level data structures (lists, maps, lists and arrays of sets and lists), a few algorithms (union/find, dfs/deep recursion, and loop recognition based on Tarjan), iterations over collection types, some object oriented features, and interesting memory allocation patterns."Run-time benchmark of C++, Go, Java and Scala

Above: Run-time measurements, including a few optimizations.

After benchmark tests were published within Google various employees took a stab at(试图作某事) optimizing the code for specific languages.

The conclusions:

  • C++ provides the best performance by far, but it requires the most extensive language-specific tuning.
  • Scala provides the most concise notation and optimization of code complexity.
  • The algorithm was simplest to implement in Java, but garbage collection settings make both Java and Scala difficult to benchmark accurately.
  • Go offers concise notion and very fast compile time, but is still immature.

The phrase "lies, damn lies and benchmarks" is by now a cliche(陈词滥调). Suffice it to say, benchmarks never tell the full story, and there are many factors to consider when choosing a programming language. That said, you may find parts of this paper enlightening, especially with regards to Scala performance.


阅读(940) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~