Optimal Programming Languages: benchmark game update

While there are a range of factors for deciding on a programming language,
let’s consider speed and source-code size (verbosity) the important factors here, If I could add a Z axis it would be popularity, I’ll briefly overview the best options all things considered at the end.

I’ve processed the benchmark game summary data with R to generate some performance graphs.  The Y axis is the compressed code bytes, and the X axis is the speed, these are logarithmic scales, so even small distances may mean big differences.  Depending on the size of your  screen you may wish to enlarge the image.  The programming languages are marked with capital letters,  the blue ones being average performance, and the red ones being median performance.

Here is a legend so you can find your favorite languages for comparison:

A Ada
a Racket
C gcc
+ C++
# C#
D Dart
e Perl
E Erlang
f F#
F Fortran
G Go
h Hack
H Haskell
J Java
j Javascript
L Lisp
o Clojure
O Ocaml
P Pascal
p Python
R Ruby
r JRuby
S Scala
s Smalltalk
T Typescript
u Lua
U Rust

Here are the single-core graphs:


Here are the multi-core graphs:


Some interesting standouts are Ada, which is the most verbose in all areas,
while Ruby and JRuby is the most concise for single core processors.

Not surprisingly C and C++ are the fastest in all areas, followed closely by Fortran. What is fairly new amongst the “racehorses” is Rust, which has come a long way, and now is neck and neck with C and C++ in the single-core domain, though is slightly more verbose in all domains, and also lags behind in median performance. Also in the C-like languages is Go, which is fairly close to optimal.

The slowest at the rear of the pack are the traditional scripting languages, Python, PHP, Perl, Lua and Ruby. Of them JRuby is the fastest, particularly in the single-core arena. They have also been recently joined by Hack, with the slightly speedier TypeScript.
TypeScript is based on Javascript, presumably it wishes to be more concise, however it is also slower.

In terms of Java inspired languages such as C# and Scala,  C# is the slowest, Scala the fastest and Java the most verbose. Java is also the most portable of them.

In terms of functional programming languages, such as Lisp, Haskell, Racket, F# and Ocaml. Haskell seems to be the closest to optimal in terms of speed, with F# being more concise.

The optimal general-purpose area to be is closest to 0,0 on the chart. It is populated by Javascript, Go, F#, Dart, Scala and Ocaml. F# and Ocaml are single platform, wheras Dart is fairly domain specific, which leaves Javascript, Go and Scala.

Thus the optimal general purpose programming language as far as I can tell is actually Javascript,  a good average of speed and verbosity, while also being popular and highly portable. It is actually only slightly slower than Java, but works on all mobile platforms, and any desktop with a modern browser. If you need to make a short on-the-fly script, then Javascript (Node.js) is best.

Though if speed is what you need, the best bet is still to go with C or C++, can always use emscripten to then port it to javascript for portability. The one issue with that tack, is lack of good parallel libraries that work both in C and Emscripten, though Pthreads has some preliminary support. With GCC you can even set cache and stack limits to help you reduce cache misses. Also there is OpenCl, which I hope will later be compilable into WebCl via emscripten or a sibling.

The sourcecode for this is libreware and available,
if someone comments I’ll post it up on sourceforge for download.

This entry was posted in Uncategorized by Logan. Bookmark the permalink.

About Logan

Hi, I'm currently working on Speakable Programming for Every Language (SPEL), to allow humanity to collagorate together in creating a General-Intelligence Operating-System (GI-OS), which can eventually aid in giving robots support for human reincarnation, thus allowing us to colonize the other planets in our solar system and the cosmos. Meanwhile I am authoring sci-fi stories to help share my vision of the future, and teaching meditation and quantum animism to provide a belief system and set of practices compatible with the oncoming future. Stories regarding my blog content have been covered in the Daily Mail, Business Insider and Technocracy News. Thank you all for helping spreading the word.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s