/
Performant Python how to write good, fast, python code Performant Python how to write good, fast, python code

Performant Python how to write good, fast, python code - PowerPoint Presentation

mitsue-stanley
mitsue-stanley . @mitsue-stanley
Follow
356 views
Uploaded On 2018-12-06

Performant Python how to write good, fast, python code - PPT Presentation

georgebernhard bkxk7com 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 ID: 737463

write python fast good python write good fast code profile vectorize cheat parallelise pythonic ftw programmers slow

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Performant Python how to write good, fas..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Performant Python

how to write good, fast, python code

@georgebernhard

bk@xk7.comSlide2

how to write

good

, fast, python codeSlide3

how to write

good

, fast, python code

how to write good,

fast

, python codeSlide4

how to write

good

, fast, python code

how to write good,

fast

, python code

how to write good, fast,

python

codeSlide5

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 KnuthSlide6

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.

Slide7

how to write

good

, fast, python code

how to write good,

fast

, python code

how to write good, fast,

python

codeSlide8

pythonic

profile

do less

vectorize

cheat

paralleliseSlide9

“python is slow”Slide10

“python is

too

slow”?Slide11

Slide12

Slide13

Slide14

“python is slow -

compared to C

”?Slide15

Slide16

Slide17

Slide18

Slide19

Slide20

Slide21

Slide22

Are we faster yet?

Slide23

Slide24

Slide25

Slide26

Slide27

Slide28

Slide29

p

ythonic

profile

do less

vectorize

cheat

paralleliseSlide30

C-Python

Slide31

Pypy

Slide32

pythonic

profile

do less

vectorize

cheat

paralleliseSlide33

good artists copy;

great artists steal.Slide34

pythonic

profile

do less

vectorize

cheat

paralleliseSlide35

Slide36

Slide37

anagram0.py

works

didn’t take long to write

Slide38

Slide39

Slide40

Python 2.7 FTW!

Slide41

PyPy FTW FTW!

Slide42

Profiling

Slide43

Batteries included!

Slide44

Slide45

Slide46

Slide47

Slide48

Slide49

Slide50

52 x faster - Datastructures FTW!

Slide51

Slide52

pythonic

profile

do less

vectorize

cheat

paralleliseSlide53

Slide54

Slide55

pythonic

profile

do less

vectorize

cheat

paralleliseSlide56

Parallelisation

Slide57

Programmers are expensive

Computers are cheapSlide58

Programmers are expensive

Computers are cheap

Lots of problems are embarrassingly parallelSlide59

Slide60

Slide61