What makes a Python debugger possible and how can we make it 100x faster
summary
Explains that debuggers rely on sys.settrace to receive call/line/return/exception events and inspect frame.f_locals and code objects, and shows why that global, per-function granularity creates huge overhead. Introduces PEP 669 / sys.monitoring which can enable chosen events on specific code objects and silence irrelevant lines, enabling an almost 100x speedup for breakpoints. Covers practical issues: more complex logic, backwards compatibility, and early adopters like PyCharm, VS Code backends, and coverage.py.
AI-written summary · about
chapters (9)
- 0:00Introduction to debuggers
- 1:00Debugger foundations
- 4:01The sys.settrace mechanism
- 6:58How PDB uses trace functions
- 9:31Information and code execution
- 11:17Execution control
- 15:12Performance overhead issues
- 18:07Speeding up with sys.monitoring
- 23:07Q&A session
related talks
30mPython 3.12's new monitoring and debugging API
23mTrace functions: Building a tiny debugger
24mLet’s Rethink Debugging
50mHow I built a power debugger out of the standard library and things I found on the internet
27mThe Hidden Power of the Python Runtime
01h 31mDebugging and profiling techniques
37mTuning Python applications can dramatically increase performance
23mThe Hitchhiker's Guide to Advanced Python Monitoring
