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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
More Decks by Chad Estioco
See All by Chad Estioco
Don't Panic
skytreader
0
38
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
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
150
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
JIS keyboard support in Omarchy
lef237
0
110
最近”作らせてる” ローカルAIアプリの話
akit37
0
470
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
500
Event is what happens
moro
2
780
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
220
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
5.2k
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
350
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
160
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
610
Featured
See All Featured
Building Adaptive Systems
keathley
44
3.2k
So, you think you're a good person
axbom
PRO
2
2.2k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
The Curious Case for Waylosing
cassininazir
1
570
Navigating Team Friction
lara
192
16k
Evolving SEO for Evolving Search Engines
ryanjones
0
330
The Language of Interfaces
destraynor
162
27k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Building AI with AI
inesmontani
PRO
1
1.3k
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1.2k
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.