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

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.

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 tech industry for major developments, new product launches, AI breakthroughs, video game releases and other newsworthy events. Editors assign relevant stories to staff writers or freelance contributors 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.

Get the biggest tech headlines of the day delivered to your inbox

    By signing up, you agree to our Terms and Privacy Policy. Unsubscribe anytime.

    Tech News

    Explore the latest in tech with our Tech News. We cut through the noise for concise, relevant updates, keeping you informed about the rapidly evolving tech landscape with curated content that separates signal from noise.

    In-Depth Tech Stories

    Explore tech impact in In-Depth Stories. Narrative data journalism offers comprehensive analyses, revealing stories behind data. Understand industry trends for a deeper perspective on tech's intricate relationships with society.

    Expert Reviews

    Empower decisions with Expert Reviews, merging industry expertise and insightful analysis. Delve into tech intricacies, get the best deals, and stay ahead with our trustworthy guide to navigating the ever-changing tech market.