Cython to speed up your Python code


Follow to receive video recommendations   a   A
Upvotes: DownVotes:
Age: 5 months     Page Views: 331
Votes / View: 24    Wilson Score: 0.68

Speaker: Are you the speaker?

`Cython `__ is not only a very fast and comfortableway to talk to native code and libraries, it is also a widely used toolfor speeding up Python code. The Cython compiler translates Python codeto C or C++ code, and applies many static optimisations that make Pythoncode run visibly faster than in the interpreter. But even better, itsupports static type annotations that allow direct use of C-C++ datatypes and functions, which the compiler uses to convert and optimise thecode into fast, native C. The tight integration of all three languages,Python, C and C++, makes it possible to freely mix Python features likegenerators and comprehensions with C-C++ features like native datatypes, pointer arithmetic or manually tuned memory management in thesame code.This talk by a core developer introduces the Cython compiler byinteractive code examples, and shows how you can use it to speed up yourreal-world Python code. You will learn how you can profile a Pythonmodule and use Cython to compile and optimise it into a fast binaryextension module. All of that, without losing the ability to run itthrough common development tools like code checkers or coverage testtools.