• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

High Performance Python for Data Analytics: Speed

Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tiago.

How does the speed of Python compare to:
- Cython?
- Java?

Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What people call Python is normally two things:

- Python the language
- CPython - the most common implementation of the language. Do not confuse CPython - the standard Python interpreter - with Cython. There are some alternatives to CPython: For example there is a Python interpreter for the JVM called Jython.

Python, being a dynamic language with lots of introspection features tends to be slow (I do believe that there is such thing as slow languages - especially if they have goodies like dynamic typing or garbage collection)

CPython as an implementation happens to be horrendously slow, further compounding the problem.

Python (for now on I will be assuming CPython when I say Python) can be made faster (*) by using libraries implemented in other languages. For instance, NumPy - Python's workhorse in data analytics - is mostly implemented in C and dependent of very efficient external algebra libraries implemented in C or Fortran.

(*) Of course code CPython code can be made faster by using best practices when coding in native Python - but that only gets yo so far.


- Python is slooow.
- Its implementation against Java on the JVM is not really comparable. Python loses, bad
- All this is circumvented by libraries implemented in lower level languages for the really computationally expensive stuff, so things end up OK.

Cython compiles Python (a super-set of Python - you really need to add type annotations and other stuff) to very efficient C. Its reasonably fair to compare it to C. Its quite easy to like Python with Cython and Cython with C libraries. Cython code can be really fast.

Cython also allows for parallel multi-threaded code. Did I mention that Python cannot have parallel threads because of the Global Interpreter Lock (GIL)?
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Python is an interpreted, high-level and general-purpose programming language. It is one of the top most languages used primarily for performing data analysis
Humans and their filthy friendship brings nothing but trouble. My only solace is this tiny ad:
a bit of art, as a gift, the permaculture playing cards
    Bookmark Topic Watch Topic
  • New Topic