Google recently conducted a benchmark of 4 programming languages Java, C , Scala, and Go, a programming language developed by Google themselves.
Google first published the benchmark internally, and as Google engineers started creating more optimized versions of their benchmarks, Google was further able to deduce the pain points in performance optimization in different languages.
The algorithm created by Google was a simple one that makes use of many language features such as "higher-level data structures (lists, maps, lists and arrays of sets and lists), a few algorithms (union/ﬁnd, dfs / deep recursion, and loop recognition based on Tarjan), iterations over collection types, some object oriented features, and interesting memory allocation patterns"
What the algorithm doesn't explore are "aspects of multi-threading, or higher level type mechanisms, which vary greatly between the languages"
The benchmark algorithm itself is open source and available at Google Code. This includes the optimized versions of the benchmark for all languages except C , since that code depends on code Google would rather nor open-source.
When it comes to the size of code, Scala and Go implementations were much shorter than the C and Java versions.In compilation time, Google's Go comes out at top, with even the fastest compilation times of other languages being 5 times slower.
On the other hand, Go has the largest compiled binary sizes, of as much as 94 times that of Java. Since Java and Scala are compiled to bytecode, they tend to be smaller, but not much smaller than the optimized C build. In memory usage, C has the advantage, followed by Scala, Go and last Java.
In terms of performance, Google's conclusion indicates that C is the best performer by a large margin, but "required the most extensive tuning efforts, many of which were done at a level of sophistication that would not be available to the average programmer"
Scala and Java run on the same JVM, and hence has the same issues in analyzing performance, and tuning garbage collection. Scala, however "allowed for the best optimization of code complexity"
Go was deemed interesting, but immature looking at the performance and binary sizes.
To read the full report by Google, click here to download the PDF of the report.