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 Profiling 101
Search
Nazar Kanaev
September 22, 2020
Programming
140
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Python Profiling 101
Nazar Kanaev
September 22, 2020
More Decks by Nazar Kanaev
See All by Nazar Kanaev
Core Data
nkanaev
0
110
Other Decks in Programming
See All in Programming
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
180
Next.js: The final boss of Web Performance
guaca
0
250
ジョジョの世界をXRで再現する
mofurune
0
160
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
160
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
180
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
6.6k
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
610
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
140
Domain-Driven Transformation
hschwentner
2
2.3k
Web Framework Benchmark Battle 2026, Any%
a_matsuda
2
2k
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
0
880
TechTown - Creating Composable Callables in Contemporary C++
rollbear
0
130
Featured
See All Featured
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
570
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
500
Color Theory Basics | Prateek | Gurzu
gurzu
1
490
Building Adaptive Systems
keathley
44
3.2k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
410
A Modern Web Designer's Workflow
chriscoyier
699
190k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.3k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Code Review Best Practice
trishagee
74
20k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.7k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Transcript
Python Profiling 101
None
What is Profiling
dynamic program analysis to measure usage / time / memory
of function calls / instructions / etc.
analyse the whole program / certain functions to find slowest
/ memory-consuming parts
None
How it works
Python API PyEval_SetTrace / PyEval_SetProfile sys.settrace / threading.settrace
OS-level API py-spy: process_vm_readv (linux) / vm_read (macos) / ReadProcessMemory
(windows) fil: malloc/calloc/alloc/free (linux & macos)
None
Choosing the right tool
deterministic vs. statistical/sampling pure-python vs. compiled call stack vs. line
granularity time vs. memory
built-in: profile/cProfile + pstats trace tracemalloc
3rd-party: vprof memory_profiler pprofile ...dozens of wrappers & custom solutions
None
Common advice
pure-python profilers add more overhead than the compiled ones choose
the latter if execution speed is more important
deterministic profiling is accurate, but slower than sampling profiling for
long-running tasks sampling profiling might be more preferred
None
The End