PYTHON ACADEMY
The Programming School

Module - Optimizing Python Programs

Motivation

Python is an interpreted language; Python source code is translate into portable byte code. This concept in combination with other design principles of Python makes many of advantages as compared to other languages possible. As a drawback the execution speed my be considerably slower for certain kinds of applications than with compiled languages. Optimization can often increase performance of Python programs substantially.

Course Content

Guidelines for Optimization

Python programs are not principally slow. On the contrary: the execution speed is sufficient for many application. The basic question is if the program serves its intended purpose. Furthermore, other factors such as database access or network connections may determine the speed of the application.

The course provides important guidelines for optimization.

Profiling

Profiling can be used to find the spots of a program that use up most of the time.

The built-in modules profile, hotshot, and timeit are used in the course. Examples of common cases will help to understand how to use them. Participants are encouraged to bring their own programs for profiling to the course.

Algorithms and Anti-Patterns

Typically the larges gains of performance can be achieved through algorithmic changes.

Algorithms that are especially slow or fast in Python are shown. The preferred use of data structures are covered as well as the use of functional programming features of Python.

Psyco

Psyco is a so called "just-in-time-complier" (JIT), which allows to translate parts of the byte code to machine code. This may yield considerable speed improvements.

Examples are used to show the different possibilities of using Psyco. Participants are encouraged to bring their own programs to the course to optimize them.

Numerical Calculations with numpy

Numerical calculations using large list are rather slow in Python. The dynamical typing can use up lots of performance. The library numpy offers efficient processing of numerical arrays. Functionality and usage are inspired by MATLAB.

The basic possibilities of numpy are covered in the course.

Overview of Extensions to Python with Other Languages

The speed of Python programs can be increased through extensions written in other languages. An overview of possibilities to extend Python are given if this module is not combined with the module Python-Extensions with Other Languages.

Module Duration

0.5 days

Exercises

The participants can follow all steps directly on their computers. There are exercises at the end of each unit providing ample opportunity to apply the freshly learned knowledge.

Course Material

Every participant receives comprehensive printed materials that cover the whole course content as wells as a CD with all source codes and used software.


Home
Python
Courses
Open Courses
Company Courses
Summer Course
Non-Programmers
Programmers
Scientists
Special Topics
Extensions
Optimizing
Windows
Threads
Network
Patterns
Dates
Prices
FAQ
Training Center
User Group
Jobboard
Workshop
EuroSciPy
References
News


What customers say ...

Very good introduction to the programming language.

Matthias Enderle, freelancer programmer
more ...


News


Next Meeting of Leipzig Python User Group, July 8th, 2008
details ...


Python Summer Course July 21 - 25, 2008
details ...


EuroSciPy July 26/27, 2008
details ...


Booth at Chemnitzer Linux-Tage
details ...


Videos Workshop 2007 available
details ...


Python is programming language of 2007
details ...


[Powered by rest2web]

[Python Powered]