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
420
TDD with Python
skytreader
1
210
Heads of the Hydra
skytreader
0
160
Other Decks in Programming
See All in Programming
フロントエンドのパフォーマンスチューニング
koukimiura
5
2k
Startups on Rails in Past, Present and Future–Irina Nazarova, RailsConf 2025
irinanazarova
0
250
Model Pollution
hschwentner
1
160
Porting a visionOS App to Android XR
akkeylab
0
680
レトロゲームから学ぶ通信技術の歴史
kimkim0106
0
110
20250704_教育事業におけるアジャイルなデータ基盤構築
hanon52_
5
1.1k
状態遷移図を書こう / Sequence Chart vs State Diagram
orgachem
PRO
2
200
スタートアップの急成長を支えるプラットフォームエンジニアリングと組織戦略
sutochin26
1
7.3k
ふつうの技術スタックでアート作品を作ってみる
akira888
1
1.3k
CDK引数設計道場100本ノック
badmintoncryer
2
480
MCPを使ってイベントソーシングのAIコーディングを効率化する / Streamlining Event Sourcing AI Coding with MCP
tomohisa
0
170
TypeScriptでDXを上げろ! Hono編
yusukebe
3
770
Featured
See All Featured
Scaling GitHub
holman
460
140k
Bash Introduction
62gerente
613
210k
Fireside Chat
paigeccino
37
3.5k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.7k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Automating Front-end Workflow
addyosmani
1370
200k
Navigating Team Friction
lara
187
15k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Rails Girls Zürich Keynote
gr2m
95
14k
The Cult of Friendly URLs
andyhume
79
6.5k
Typedesign – Prime Four
hannesfritz
42
2.7k
Raft: Consensus for Rubyists
vanstee
140
7k
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.