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
今ならAmazon ECSのサービス間通信をどう選ぶか / Selection of ECS Interservice Communication 2025
tkikuc
21
3.9k
Azure AI Foundryではじめてのマルチエージェントワークフロー
seosoft
0
160
PicoRuby on Rails
makicamel
2
120
新メンバーも今日から大活躍!SREが支えるスケールし続ける組織のオンボーディング
honmarkhunt
3
5.9k
PostgreSQLのRow Level SecurityをPHPのORMで扱う Eloquent vs Doctrine #phpcon #track2
77web
2
500
20250628_非エンジニアがバイブコーディングしてみた
ponponmikankan
0
660
PHPでWebSocketサーバーを実装しよう2025
kubotak
0
270
チームで開発し事業を加速するための"良い"設計の考え方 @ サポーターズCoLab 2025-07-08
agatan
0
180
Composerが「依存解決」のためにどんな工夫をしているか #phpcon
o0h
PRO
1
250
WindowInsetsだってテストしたい
ryunen344
1
240
ふつうの技術スタックでアート作品を作ってみる
akira888
0
440
GraphRAGの仕組みまるわかり
tosuri13
8
530
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
20
1.3k
KATA
mclloyd
30
14k
A designer walks into a library…
pauljervisheath
207
24k
The Art of Programming - Codeland 2020
erikaheidi
54
13k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Why You Should Never Use an ORM
jnunemaker
PRO
58
9.4k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
810
Side Projects
sachag
455
42k
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.