C, C++, Java och Python - En prestandajämförelse mellan fyra programmeringsspråk
DatavetenskapComputer science - software engineeringComputer science - computersystemsProgramming languageComparisonJavaCC++PythonPerformance
In today?s society computers are getting a much more important role. To get a
computer to work
as intended it has to be programmed. A computer program is written with
programming
languages.
There is an abundance of programming languages available today and there are
many
differences and similarities between them. The different languages have their
advantages and
their disadvantages where some of them are intended for fast performance, some
to be cheap
on memory usage, and some are developed to be easy to program on.
In our thesis we have chosen to compare four of todays most common languages,
C, C++, Java
and Python. These languages were chosen because we have worked with three of
them during
our study period (C, C++ and Java). Python was chosen because it is an
interpreted language
and not a compiled one. It also have a very different syntax compared to the
other languages
which makes it interesting. Our comparison, which focuses on performance, has
its foundation
in the tests we have made, but also on results from a research survey that we
also made. I this
survey forty software developers, from Swedish companies, have participated.
The tests we have made measure the languages performance, regarding time, by
implementing
and running two common algorithms. During these tests vi have also chosen to
register the
amount of memory these algorithms use during runtime.
The results we have extracted from our tests and our survey are compiled, and
these results are
then analysed to be able to compare the four programming languages to each
other.
The tests that have been done show that Java is the language that performs
best, with C and C
++ second best and then Python performing the worst. Our survey answers, on the
other hand,
indicates that C and C++ should have outperformed Java.