Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Performant Python
how to write good, fast, python code
@georgebernhard
bk@xk7.com
how to write good, fast, python code
how to write good, fast, python code
how to write good, fast, python code
how to write good, fast, python code
how to write good, fast, python code
how to write good, fast, python code
import this
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is bet...
how to write good, fast, python code
how to write good, fast, python code
how to write good, fast, python code
https://twitter.com/jakevdp/status/850373744644182017
Programmers are expensive
Computers are cheap
how to write good, fast, python code
how to write good, fast, python code
how to write good, fast, python code
how to write good, fast, python code
how to write good, fast, python code
how to write good, fast, python code
Programmers waste enormous amounts of time thinking
about, or worrying about, the speed of noncritical parts of
their prog...
Programmers waste enormous amounts of time thinking
about, or worrying about, the speed of noncritical parts of
their prog...
Programmers waste enormous amounts of time thinking
about, or worrying about, the speed of noncritical parts of
their prog...
how to write good, fast, python code
Profiling
Batteries included!
python -m cProfile anagram0.py >
profile_anagram0.txt
how to write good, fast, python code
how to write good, fast, python code
Programmers waste enormous amounts of time thinking
about, or worrying about, the speed of noncritical parts of
their prog...
how to write good, fast, python code
Programmers waste enormous amounts of time thinking
about, or worrying about, the speed of noncritical parts of
their prog...
“Premature optimization is the root of all evil, so to start this project I'd better come
up with a system that can determ...
Fin.
Micro optimisations
http://www.freeimageslive.co.uk/f
If you want to see my slides on micro optimisations,
you can see them below.
Anagrams
anagram0.py
+ works
+ didn’t take long to write
Python 2.7 FTW!
PyPy FTW FTW!
52 x faster - Datastructures FTW!
What are you doing?
And now for something completely different….
Variations on an almost trivial sum….
Tools
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
PyParis2017 / Performant python, by Burkhard Kloss
Upcoming SlideShare
Loading in …5
×
Upcoming SlideShare
What to Upload to SlideShare
Next
Download to read offline and view in fullscreen.

0

Share

Download to read offline

PyParis2017 / Performant python, by Burkhard Kloss

Download to read offline

PyParis 2017
http://pyparis.org

Related Books

Free with a 30 day trial from Scribd

See all
  • Be the first to like this

PyParis2017 / Performant python, by Burkhard Kloss

  1. 1. Performant Python how to write good, fast, python code @georgebernhard bk@xk7.com
  2. 2. how to write good, fast, python code
  3. 3. how to write good, fast, python code how to write good, fast, python code
  4. 4. how to write good, fast, python code how to write good, fast, python code how to write good, fast, python code
  5. 5. import this Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts.
  6. 6. how to write good, fast, python code how to write good, fast, python code how to write good, fast, python code
  7. 7. https://twitter.com/jakevdp/status/850373744644182017
  8. 8. Programmers are expensive Computers are cheap
  9. 9. how to write good, fast, python code how to write good, fast, python code how to write good, fast, python code
  10. 10. how to write good, fast, python code
  11. 11. how to write good, fast, python code
  12. 12. how to write good, fast, python code
  13. 13. Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered.
  14. 14. Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.
  15. 15. Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%. Donald Knuth
  16. 16. how to write good, fast, python code
  17. 17. Profiling
  18. 18. Batteries included! python -m cProfile anagram0.py > profile_anagram0.txt
  19. 19. how to write good, fast, python code
  20. 20. how to write good, fast, python code
  21. 21. Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%. Donald Knuth
  22. 22. how to write good, fast, python code
  23. 23. Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%. Donald Knuth
  24. 24. “Premature optimization is the root of all evil, so to start this project I'd better come up with a system that can determine whether a possible optimization is premature or not."
  25. 25. Fin.
  26. 26. Micro optimisations
  27. 27. http://www.freeimageslive.co.uk/f
  28. 28. If you want to see my slides on micro optimisations, you can see them below.
  29. 29. Anagrams
  30. 30. anagram0.py + works + didn’t take long to write
  31. 31. Python 2.7 FTW!
  32. 32. PyPy FTW FTW!
  33. 33. 52 x faster - Datastructures FTW!
  34. 34. What are you doing?
  35. 35. And now for something completely different….
  36. 36. Variations on an almost trivial sum….
  37. 37. Tools

PyParis 2017 http://pyparis.org

Views

Total views

325

On Slideshare

0

From embeds

0

Number of embeds

1

Actions

Downloads

13

Shares

0

Comments

0

Likes

0

×