Performant Pythonhow to write good, fast, python code
how to write good, fast, python code
how to write good, fast, python codehow to write good, fast, python code
how to write good, fast, python codehow to write good, fast, python codehow to write good, fast, python code
import thisBeautiful 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.
how to write good, fast, python codehow to write good, fast, python codehow to write good, fast, python code
https://twitter.com/jakevdp/status/850373744644182017\
Programmers are expensive
Computers are cheap
how to write good, fast, python codehow to write good, fast, python codehow 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 programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered.
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.
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
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 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
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 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
“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."
Fin.
Micro optimisations
http://www.freeimageslive.co.uk/free_stock_image/labreatarpitsjpg
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