Return to search

Benchmarking Python Interpreters : Measuring Performance of CPython, Cython, Jython and PyPy / Jämförelse av Pythoninterpreterarna CPython, Cython, Jython och PyPy

For the Python programming language there are several different interpreters and implementations. In this thesis project the performance regarding execution time is evaluated for four of these; CPython, Cython, Jython and PyPy. The performance was measured in a test suite, created during the project, comprised of tests for Python dictionaries, lists, tuples, generators and objects. Each test was run with both integers and objects as test data with varying problem size. Each test was implemented using Python code. For Cython and Jython separate versions of the test were also implemented which contained syntax and data types specific for that interpreter. The results showed that Jython and PyPy were fastest for a majority of the tests when running code with only Python syntax and data types. Cython uses the Python C/API and is therefore dependent on CPython. The performance of Cython was therefore often similar to CPython. Cython did perform better on some of the tests when using Cython syntax and data types, as it could therefore decrease its reliance to CPython. Each interpreter was able to perform fastest on at least one test, showing that there is not an interpreter that is best for all problems. / Det existerar flera olika implementationer och interpreterare för programmeringsspråket Python. I detta examensarbete evalueras prestandan avseende exekveringstid för fyra av dessa; CPython, Cython, Jython och PyPy. Prestandan mättes i en testsvit som skapades i detta projekt. Testsviten bestod av tester för Pythons dictionary, list, tuple, generator och objekt. Varje test kördes med bå de heltal och objekt som testdata med varierande problemstorlek. Varje test var implementerat i programmeringsspråket Python. För Cython och Jython implementerades ytterliggare en version av testerna som innehöll syntax och datatyper specifika för dessa interpreterare. Resultaten visade att Jython och PyPy var snabbast för en majoritet av testerna som endast använde sig av Pythons syntax och datatyper. Cython använder sig av Pythons C/API och är därför beroende av CPython. Prestandan av Cython var därför lik CPythons. Cython presterade bättre på vissa av testerna som utnyttjade Cythons syntax och datatyper, då den därmed kunde minska sitt beroende av CPython. Varje interpreterare lyckades prestera snabbast på minst ett test. Detta visar att det inte finns en interpreterare som är mest lämpad för alla problem.

Identiferoai:union.ndltd.org:UPSALLA1/oai:DiVA.org:kth-183547
Date January 2016
CreatorsRoghult, Alexander
PublisherKTH, Skolan för datavetenskap och kommunikation (CSC)
Source SetsDiVA Archive at Upsalla University
LanguageEnglish
Detected LanguageEnglish
TypeStudent thesis, info:eu-repo/semantics/bachelorThesis, text
Formatapplication/pdf
Rightsinfo:eu-repo/semantics/openAccess

Page generated in 0.0018 seconds