Change search
ReferencesLink to record
Permanent link

Direct link
Benchmarking Python Interpreters: Measuring Performance of CPython, Cython, Jython and PyPy
KTH, School of Computer Science and Communication (CSC).
2016 (English)Independent thesis Advanced level (degree of Master (Two Years)), 20 credits / 30 HE creditsStudent thesisAlternative title
Jämförelse av Pythoninterpreterarna CPython, Cython, Jython och PyPy (Swedish)
Abstract [en]

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.

Abstract [sv]

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.

Place, publisher, year, edition, pages
Keyword [en]
Python Cython CPython Jython PyPy
National Category
Computer Science
URN: urn:nbn:se:kth:diva-183547OAI: diva2:912464
Educational program
Master of Science in Engineering - Computer Science and Technology
Available from: 2016-03-18 Created: 2016-03-16 Last updated: 2016-03-18Bibliographically approved

Open Access in DiVA

fulltext(2221 kB)74 downloads
File information
File name FULLTEXT01.pdfFile size 2221 kBChecksum SHA-512
Type fulltextMimetype application/pdf

By organisation
School of Computer Science and Communication (CSC)
Computer Science

Search outside of DiVA

GoogleGoogle Scholar
Total: 74 downloads
The number of downloads is the sum of all downloads of full texts. It may include eg previous versions that are now no longer available

Total: 182 hits
ReferencesLink to record
Permanent link

Direct link