Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Python at the Speed of Light (ok, not really)
Search
Chad Estioco
February 23, 2014
Programming
290
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Python at the Speed of Light (ok, not really)
Talk done for Chikka at PyCon PH 2014.
Chad Estioco
February 23, 2014
Transcript
34 slides
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.
More Decks by Chad Estioco
See All by Chad Estioco
Don't Panic
skytreader
0
42
The Use of Useless Things
skytreader
0
520
TDD with Python
skytreader
1
290
Heads of the Hydra
skytreader
0
240
Other Decks in Programming
See All in Programming
どうしても Eloquent でリポジトリパターンをやりたいんだ #phpcon_niigata / phpcon-niigata-2026
shogogg
0
680
止まらない比較を止める — 余帰納法で無限ストリームを比べる
tarao
0
210
Spec-driven Development with AI
simas
PRO
0
2.3k
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
220
[DroidKnights 2026] Workflow AX: From Auto-Documented Policies to E2E Testing
raeminkang
0
610
そのデザイントークン、Flutterでも同じ見た目になりますか?
nakamizu
0
470
Scalaの型でマルチテナントの認可を守る
nextbeatdev
0
180
Ruby から Emacs を操作したい
phigasui
0
390
将来の標準フォーマッター?ktfmtを深堀る
t45k
0
250
眠らない開発チームの作り方
biwakonbu
0
110
imagewebp()の向こう側: WebPはなぜ JPEG・PNGより軽いのか
yuzneri
0
150
マルチプロダクトSaaSの アプリ一覧を速くする——複数プロダクトにまたがる「権限行脚」を減らすまで #techramen26conf
mktakuya
1
210
Featured
See All Featured
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
570
Building Flexible Design Systems
yeseniaperezcruz
330
41k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
610
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.2k
KATA
mclloyd
PRO
35
16k
My Coaching Mixtape
mlcsv
0
400
The Pragmatic Product Professional
lauravandoore
37
7.5k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Mind Mapping
helmedeiros
1
450
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
Technical Leadership for Architectural Decision Making
baasie
4
660