+1 -1 +30
Vote on this proposal

Medusa: A much faster Python implementation based on the Dart Virtual Machine

by Rahul De (speaking)

Section
Core Python
Technical level
Intermediate

Objective

Get to know about Medusa: a new innovative Python implementation harnessing Google's super fast Dart Virtual Machine running Python at near native speeds.

Description

The session will formally unveil the Medusa project.

Python being an interpreted language has its pros and cons and at this PyCon we are going fix one of the most obvious cons of Python: its execution speed.
We all love Python for its simplicity and flexibility but when it comes to writing large volumes of code involving complex operations and recursions Python somewhat falls short compared to the other native/JIT languages.

In late 2012, Google came up with Dart, a language aiming for the unification of server and client side web development and scalable apps. Along with it came The Dart Virtual Machine. A hyper fast VM which builds upon the V8 js engine and even outperforms it. We decided why not let Python have a go on this?

The main aim behind creating the Medusa project is giving a typless and flexible language like Python a faster execution environment while still maintaining all its flexibility which we all love. Numerous projects such as the ShedSkin project which converts implicitly typed Python to C++ have tried doing it, but have put some or the other restriction on the input Python code. The Medusa project aims at running pre-existing Python code without any or minimal modification at a much faster rates compared to the usual implementations.

Still in its nascent stages and implemented using Qt/C++, Python and Dart, the project works by compiling Python code to a highly optimized Dart code in real time, persistently caching it and letting it rip on the Dart VM. The Dart VM like V8 compiles the dart code directly to machine code and using its vast array of runtime optimizations runs at a much higher speed compared to the CPython implementation and at times upto a 1000 - 1500% faster while maintaining all the features Python offers. Apart from this Python is further enriched with extra features provided by the Dart VM and you can do more stuff with Python which isn't possible with the vanilla Python.

Requirements

Familiarity with Python, C++, Dart(an added bonus) and Programming Language Translation.

Speaker bio

I am a 22 year old recent VIT University graduate working for MartMobi Technologies as the back end and infrastructure engineer. I love systems programming and am really passionate about core systems and programming. My areas of interest are compilers, virtual machines, server programming and game development. I have done quite a few notable projects including a DMBS engine written from scratch and a whole new Symmetric Stream Cipher. I love exploring new creative and unorthodox possibilities and believe in the art rather than the science of computer programming.

Comments


  • 1

    [-] Rahul De 322 days ago

    Heres is the slideshare link, if the above ones creating issues:
    http://www.slideshare.net/CrossPlatform1/the-medusa-project


  • 1

    [-] Kushal Das 270 days ago

    Are you a contributor to that project ?


  • 1

    [-] Kracekumar Ramaraju 252 days ago

    So it is a language like python with few extra things built using Dart VM ? Can you show us some sample code which does work in vanilla python and doesn't work in vanilla python ?


    • 1

      [-] Rahul De 252 days ago (edited 252 days ago)

      The Python code is compiled into a semantically equivalent Dart code on the fly, persistently cached and executed on the Dart VM. This way that Python code is now able to access Dart features and run at much faster speeds due to the direct Dart to Assembly JIT compiling the Dart VM does. And due to the fact that a compile step takes place, so the compiler is able to figure out stuff which the usual Python interpreter cannot.

      For example the code:

      sayHello()

      def sayHello(): print "Hello"

      This wont run in the normal cpython implementation as it interprets and the function sayHello is called before its defined. But Medusa can figure this out and generate the dart code accordingly and produce Hello as an output as intended. Similarly classes and their objects are resolved too.

Login with Twitter or Google to leave a comment →