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

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.”

Image

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.”


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

Image

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.

About ReadWrite’s Editorial Process

The ReadWrite Editorial policy involves closely monitoring the gambling and blockchain industries for major developments, new product and brand launches, game releases and other newsworthy events. Editors assign relevant stories to in-house staff writers with expertise in each particular topic area. Before publication, articles go through a rigorous round of editing for accuracy, clarity, and to ensure adherence to ReadWrite's style guidelines.