Difference between revisions of "Performance of Programs Written in Twelve Programming Languages"

From ICPC
Jump to: navigation, search
(Created page with "Title: Performance of Programs Written in Twelve Programming Languages Abstract We collected the time it took to run programs written in different programming languages....")
 
(No difference)

Latest revision as of 09:56, 12 May 2016

Title: Performance of Programs Written in Twelve Programming Languages

Abstract

We collected the time it took to run programs written in different programming languages. Programs were written in twelve programming languages to solve twelve ICPC-style problems. The algorithms used per problem were mostly the same for the different programming languages. Although, some languages tend towards lists rather than random access arrays. All the programs were run on test cases of different sizes for each problem. The solutions to the problems were chosen to represent a range of time-complexity classes.

As always the results have to be treated with extreme skepticism due to many uncontrollable factors, not to mention the diversity of the implementations. However, the general trends might be considered representative and so could predict what might happen during a programming competition.

Python and Lua programs were generally the slowest at solving the chosen Problems, with Python 3 being slower than Python 2. C and C++ programs generally ran in the least amount of time -- though not always.

The evidence seems to suggest that for very short allotments of time, say one second, the difference in programming languages swamps the difference in choice of algorithms.

We have not yet run experiments using different combinations of flags to the various language translators.

Some of the problems:
USACO, February 2016.         Load Balancing
ACM ICPC SER, 2008.           Heart of the Country
ACM ICPC SER, 2008.           Lawrence of Arabia
ACM ICPC World Finals, 1990.  Rare Order
ACM ICPC World finals, 2015.  Cutting Cheese
 
 
The implementations (minor variations on different platforms):
Ada             GNATMAKE GPL 2015 (20150428-49)
C (gnu)         gcc (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
C++ (gnu)       g++ (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
C# (mcs)        Mono C# compiler version 3.2.8.0
Haskell GHC     The Glorious Glasgow Haskell Compilation System, version 7.10.2
Java            java version "1.8.0_77"
                Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
                Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
Go              go version go1.2.1 linux/amd64
Lua             Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
Pascal (fpc)    2014/01/22 2.6.2-8
Python 2        Python 2.7.6
Python 3        Python 3.4.3
Scala           Scala compiler version 2.12.0-M2 -- Copyright 2002-2013, LAMP/EPFL