Home >>> Courses >>> Optimization at EuroPython 2016

What customers say ...


We had a wide range of Python experience in our group and each person gained something valuable to take away....

Dr. Ryan Woodard, Chair of Entrepreneurial Risks, ETH ETH Zurich, Switzerland more...


pleasant atmosphere, great full-service setup right group size

Paul Zielke, Bosch Rexroth AG about the course "Python for Programmers" more...


Good content, thorough explanation, and practice sessions. It will be useful in my day-to-day work. Thank you, Mike!!

Ameya Tipnis, QSpin Vlaanderen bvba about the course "Python for Programmers" more...


Extremely valuable. We covered so much good material.

Maura Connolly, Seagate about the course "Python for Scientists and Engineers" more...


I can absolutely recommend this course to everybody who wants to become productive with Python very quickly. ...

Dr. med. Beat Meister, Bern, Switzerland more...


Faster Python Programs - Measure, don't Guess

Dates for Open Courses

Course available as open and in-house training. Currently no dates for open courses. Please ask us at info@python-academy.de

Description

Optimization can often help to make Python programs faster or use less memory. Developing a strategy, establishing solid measuring and visualization techniques as well as knowing about algorithmic basics and datastructures are the foundation for a successful optimization. The tutorial will cover these topics. Examples will give you a hands-on experience on how to approach efficiently.

Audience

Programmers with good basic Python knowledge. No previous knowledge in the field of optimization is required.

Objectives

This tutorial will help you to get the most out of your optimization work. You will learn useful techniques for details combined with an overall strategy for the big picture.

Detailed Abstract

Python is a great language. But it can be slow compared to other languages for certain types of tasks. If applied appropriately, optimization may reduce program runtime or memory consumption considerably. But this often comes at a price. Optimization can be time consuming and the optimized program may be more complicated. This, in turn, means more maintenance effort. How do you find out if it is worthwhile to optimize your program? Where should you start? This tutorial will help you to answer these questions. You will learn how to find an optimization strategy based on quantitative and objective criteria. You will experience that one's gut feeling what to optimize is often wrong.

The solution to this problem is: „Measure, Measure, and Measure!“. You will learn how to measure program run times as well as profile CPU and memory. There are great tools available. You will learn how to use some of them. Measuring is not easy because, by definition, as soon as you start to measure, you influence your system. Keeping this impact as small as possible is important. Therefore, we will cover different measuring techniques.

Furthermore, we will look at algorithmic improvements. You will see that the right data structure for the job can make a big difference. Finally, you will learn about different caching techniques.

Outline

  • How Fast is Fast Enough? (5 min)
  • Optimization Guidelines and Strategy (10 min)
  • Measuring run time
    • time, timeit, decorators for timing (5 min)
    • Wall Clock vs. CPU Time (2 min)
  • Profiling CPU Usage
    • cProfile (10 min)
    • A Picture is Worth a Thousand Words
      • SnakeViz (10 min)
    • Going Line-by-Line (5 min)
    • Exercise (15 min)
  • Profiling Memory Usage
    • Pympler (5 min)
    • Memory Usage Line-by-Line with memory_profiler (5 min)
    • Roll your own (5 min)
    • Exercise (10 min)
  • Algorithms and Anti-patterns
    • String Concatenation (3 min)
    • List and Generator Comprehensions (5 min)
    • Think Global buy Local (5 min)
    • Exercise (5 min)
  • The Right Data Structure
    • Use built-in Data Types (2 min)
    • list vs. set (3 min)
    • list vs. deque (5 min)
    • dict vs. defaultdict (5 min)
    • Big-O notation and Data Structures (5 min)
    • O(1) vs. O(n) vs. O(n) (5 min)
    • Exercise (15 min)
  • Caching
    • Reuse before You Recalculate (5 min)
    • Deterministic caching (5 min)
    • Non-deterministic caching (5 min)
    • Least Recently Used Cache (5 min)
    • Memcached (5 min)
    • Exercise (10 min)

More Info

You will need Python 2.7 or 3.5 installed on your laptop. Python 2.6 or 3.3/3.4 should also work. Python 3.x is strongly preferred.

IPython Notebook

I will use an IPython Notebook for the tutorial because it makes a very good teaching tool. You are welcome to use the setup you prefer, i.e editor, IDE, REPL. If you also like to use an IPython Notebook, I recommend conda for easy installation. Similarly to virtualenv, conda allows creating isolated environments but allows binary installs for all platforms.

There are two ways to install IPython via conda:

  1. Use Minconda. This is a small install and (after you installed it) you can use the command conda to create an environment: conda create -n bilbao2016 python=3.5` Now you can change into this environment: ``source activate bilbao2016. The prompt should change to (bilbao2016). Now you can install IPython: conda install IPython.
  2. Install Anaconda and you are ready to go if you don't mind installing lots of packages from the scientific field.

The second option also gives you conda and you can create more environments just as with Miniconda (see 1.).

Working witch conda environments

After creating a new environment, the system might still work with some stale settings. Even when the command which tells you that you are using an executable from your environment, this might actually not be the case. If you see strange behavior using a command line tool in your environment, use hash -r and try again. Please install pip inside this environment:

conda install pip

Tools

You can install these with pip (in the active conda environment):

Linux

Using the package manager of your OS should be the best option.

Course Duration

0.5 days, July (day not fixed yet), 2016,

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 all source codes.

Costs

You need to register at EuroPython 2016.



The Python Academy is sponsor of PyConIE 2017.

[PyConIE 2017]

The Python Academy is sponsor of EuroPython 2017.

[EuroPython 2017]

The Python Academy is sponsor of PyCon US 2017.

[PyCon US 2017]

The Python Academy is sponsor of PythonCamp Köln 2017.

[PythonCamp 2017]

The Python Academy is sponsor of Django Girls Leipzig 2016

[Django Girls Leipzig 2016]

The Python Academy is sponsor of PyCon DE 2016.

[PyCon DE 2016]

The Python Academy is sponsor of PyCon Ireland 2016.

[PyCon IE 2016]

The Python Academy is sponsor of EuroSciPy 2016.

[EuroSciPy 2016]

The Python Academy is sponsor of PyCon US 2016.

[PyCon US 2016]

The Python Academy is sponsor of PyData Berlin 2016.

[PyData Berlin 2016]

The Python Academy is sponsor of PyCon Sweden 2016.

[PyCon SE 2016]

The Python Academy is sponsor of Python Unconference 2015.

[PyUnconf 2015]

The Python Academy is sponsor of EuroSciPy 2015.

[EuroSciPy 2015]

The Python Academy is sponsor of EuroPython 2015.

[EuroPython 2015]

The Python Academy is sponsor of PyData Berlin 2015.

[PyData Berlin 2015]

The Python Academy is sponsor of PyCon Montréal 2015.

[PyCon Montréal 2015]

The Python Academy is sponsor of Python BarCamp Köln 2015.

[Python BarCamp 2015]https://www.euroscipy.org/2016/

The Python Academy is sponsor of Chemnitzer Linux-Tage 2015.

Chemnitzer Linux-Tage 2015 - 21. und 22. März 2015

The Python Academy is sponsor of Django Girls Wroclaw 2015.

[Django Girls Wroclaw 2015]

The Python Academy is sponsor of PyCon Ireland 2014.

[PyCon Ireland 2014]

The Python Academy is sponsor of EuroSciPy 2014.

[EuroSciPy 2014]

The Python Academy is sponsor of PyData London 2014.

[PyData London 2014]

The Python Academy is sponsor of EuroPython 2014.

[EuroPython 2014]

The Python Academy is sponsor of PyCon 2014 Montréal.

[PyCon 2014 Montréal]

The Python Academy is sponsor of Python BarCamp Köln 2014.

[Python BarCamp 2014]

The Python Academy is sponsor of PyConDE 2013.

[PyCon DE 2013]

The Python Academy is sponsor of EuroPython 2013.

[EuroPython 2013]

The Python Academy is sponsor of PyCon US 2013.

[PyCon US 2013]

The Python Academy is sponsor of EuroSciPy 2013.

[EuroSciPy 2013]

The Python Academy is sponsor of PyConPL 2012.

[PyCon PL 2012]

News


The next open cousers
details ...


Python Academy sponsors EuroPython conference 2013
details ...


Python Academy sponsors EuroSciPy conference 2013
details ...


Python Academy sponsors Python BarCamp in Cologne
details ...


Next Meeting of Leipzig Python User Group, November 12, 2013
details ...


Introduction to Django, November 11 - 13, 2013
details ...


Professional Testing with Python, November 25 - 27, 2013
details ...


Advanced Django, January 13 - 15, 2014
details ...


Python Academy sponsors PyCon US conference 2013
details ...


Python Academy founder receives PSF Community Service Award
details ...