Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Python at the Speed of Light (ok, not really)
Search
Chad Estioco
February 23, 2014
Programming
0
210
Python at the Speed of Light (ok, not really)
Talk done for Chikka at PyCon PH 2014.
Chad Estioco
February 23, 2014
Tweet
Share
More Decks by Chad Estioco
See All by Chad Estioco
Don't Panic
skytreader
0
30
The Use of Useless Things
skytreader
0
430
TDD with Python
skytreader
1
210
Heads of the Hydra
skytreader
0
160
Other Decks in Programming
See All in Programming
CSC509 Lecture 05
javiergs
PRO
0
300
クラシルを支える技術と組織
rakutek
0
200
Your Perfect Project Setup for Angular @BASTA! 2025 in Mainz
manfredsteyer
PRO
0
160
タスクの特性や不確実性に応じた最適な作業スタイルの選択(ペアプロ・モブプロ・ソロプロ)と実践 / Optimal Work Style Selection: Pair, Mob, or Solo Programming.
honyanya
3
160
TFLintカスタムプラグインで始める Terraformコード品質管理
bells17
2
130
私はどうやって技術力を上げたのか
yusukebe
43
18k
私達はmodernize packageに夢を見るか feat. go/analysis, go/ast / Go Conference 2025
kaorumuta
2
530
なぜGoのジェネリクスはこの形なのか? Featherweight Goが明かす設計の核心
ryotaros
7
1.1k
What's new in Spring Modulith?
olivergierke
1
140
Django Ninja による API 開発効率化とリプレースの実践
kashewnuts
0
1.3k
Foundation Modelsを実装日本語学習アプリを作ってみた!
hypebeans
0
100
Goで実践するドメイン駆動開発 AIと歩み始めた新規プロダクト開発の現在地
imkaoru
4
810
Featured
See All Featured
The Cost Of JavaScript in 2023
addyosmani
53
9k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
900
A better future with KSS
kneath
239
18k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
RailsConf 2023
tenderlove
30
1.2k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
Mobile First: as difficult as doing things right
swwweet
224
10k
Site-Speed That Sticks
csswizardry
11
890
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
9
590
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.7k
The Power of CSS Pseudo Elements
geoffreycrofte
79
6k
Transcript
Python in the Speed of Light (ok, not really)
Chad n. chocolate-consuming, code-churning, curious creature currently coding for Chikka’s
Connectiviteam (sic) who? me?
the sad truth: python is s.l.o.w.
the sad truth: python is s.l.o.w. http://benchmarksgame.alioth.debian.org/u64q/benchmark.php? test=all&lang=python3&data=u64q
so how come we can live with it? Source: http://www.python.org/about/quotes/
alas! all is not yet lost! (yay!)
we can optimize stuff (lots of it!)
we can optimize algorithms
[optimize algorithms] Big-“Oh” notation: O(f(n)) naive, what you probably learned
in CS undergrad
we can optimize architecture
[optimize architecture]
we can optimize actual runtime
[optimize runtime] JIT in a nutshell: good? bad?
[optimize runtime] PyPy Stackless
we can optimize hardware
[optimize hardware] do not confuse with CPython!
[optimize hardware] PyCUDA!
[optimize hardware] more in a short while after this mini
public service announcement...
we can also micro-optimize (oh… :[ )
[micro-optimization] if most probable condition: do_stuff() elif next most probable
condition: do_stuff() elif third most probable condition: do_stuff() . . . . . . . . . else: # least probable condition do_stuff() ever heard of this pattern? →
[back to regular programming*] let’s talk a bit about gevent
*pun intended
gevent is… 53.7% Python 35.8% C 10.3% Shell 0.1% Other
See: https://github.com/surfly/gevent
gevent is… 53.7% Python 35.8% C 10.3% Shell 0.1% Other
See: https://github.com/surfly/gevent ← see here, C here?
gevent a closer look installing from github … pip install
cython git+git://github.com/surfly/gevent. git#egg=gevent See: https://github.com/surfly/gevent#installing-from-github
cython: what? when? how?
what cython? Python → machine code
when cython? let C handle the bottleneck
how cython? ...and now, source code
speed of C + syntax of Python? cython everything!
pycuda: numbers/matrices/math anyone?
what about graphics?
cuda comes from nvidia
gpu parallelism + syntax of Python? pycuda everything!
take optimization and benchmarking with grains of salt. lots of
it. experimental set-ups vary greatly from real-world environments.