~/talk

Reducing your memory footprint by 75% with 6 lines of code

Talkat PyCon Israel 2024 · on Monday, 2024-09-16· [python, web-performance]
linkedin:tbrisker
slides:none on file

Claims a 75% memory reduction and large runtime and startup wins by changing a few lines where AbstractBaseClass checks cause massive recursive subclass and instance probing. Uses cProfile, a flame chart and a memory profiler to find millions of tiny allocations (11M allocations, ~1.8GB in a 12s run) traced to abc.ABCMeta __subclasscheck__/__instancecheck__ work. Replacing the expensive check with direct registration/shortcut logic (six to eight lines) eliminates the allocations and fixes the leak.

AI-written summary · about

  1. 0:00Introduction and confession
  2. 2:25Identifying the performance problem
  3. 4:16Types of profilers
  4. 7:15Analyzing slow function calls
  5. 11:38Memory leaks and profiling
  6. 14:14Investigating the bug
  7. 16:56Abstract base classes and registration
  8. 18:44The fix and its impact
  9. 20:11Results and benefits
  10. 20:37Q&A session
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.