Skip to content
← All tracks

Under the Hood: Objects, Memory, Speed

Python

The object model, refcounting and the GC, `__slots__`, big-O traps, `timeit` and deterministic profiling.

This track is written for Python, which isn't the mode you're browsing in.

0 / 13 solved · 22 articles
  1. 1. The CPython object model: names, objects and why assignment never copies Read
  2. 2. Reference counting, and the four ways it stops being deterministic Read
  3. 3. Not solved yet. The __exit__ contract: return the resource, propagate the exception
  4. 4. Reference cycles and the generational collector Read
  5. 5. Not solved yet. Walking an object graph with gc.get_referents
  6. 6. The incremental-GC episode: how to read release notes properly Read
  7. 7. gc.freeze, pre-fork copy-on-write, and why gc.disable() is usually a mistake Read
  8. 8. Weak references, and why @lru_cache on a method leaks Read
  9. 9. Not solved yet. A registry that does not prevent collection
  10. 10. Identity vs equality: the three guarantees, and everything else Read
  11. 11. Not solved yet. Identity vs equality: fix the planted `is`
  12. 12. Interning: a real memory optimisation, and never a correctness guarantee Read
  13. 13. Shallow vs deep copy, the memo dict, and copy.replace Read
  14. 14. Not solved yet. Selective deep copy: one memo, and the sharing you meant to keep
  15. 15. __slots__ in 2026: measuring it properly, and why attribute access is a wash Read
  16. 16. sys.getsizeof and why it lies Read
  17. 17. Not solved yet. deep_sizeof: count every distinct object exactly once
  18. 18. tracemalloc: turning 'the service leaks' into a file and a line number Read
  19. 19. Not solved yet. find_growth: measure retention, and stop the tracer on every path
  20. 20. Big-O traps I: list vs deque vs set vs dict, with numbers Read
  21. 21. Not solved yet. Order-preserving dedupe and a real sliding window
  22. 22. Big-O traps II: the string-concatenation cliff Read
  23. 23. Not solved yet. render_report: join for str, bytearray for bytes
  24. 24. Not solved yet. Accidental quadratics: an index-backed join and a streaming top-k
  25. 25. timeit: microbenchmarking that isn't a lie Read
  26. 26. Not solved yet. timeit: take the minimum, and put the collector back
  27. 27. Why wall-clock benchmarking misleads Read
  28. 28. Deterministic profiling: tottime vs cumtime, and what cProfile is not for Read
  29. 29. Not solved yet. hot_functions: the column you sort by is the answer you get
  30. 30. PEP 799 and Tachyon: profiling a running production process Read
  31. 31. The profiling toolbox beyond the stdlib Read
  32. 32. The CPython JIT: an honest status report Read
  33. 33. When to reach for NumPy, and when it makes things slower Read
  34. 34. Not solved yet. Moving average twice: naive, cumulative-sum, and knowing which to use
  35. 35. When to write a C or Rust extension Read

Check yourself

4 questions · one attempt each

These do not count toward finishing the track. They are here to catch the things that are easy to read past.

0 / 4

Why is comparing id() values across time unreliable?

id(SomeClass())
id(SomeClass())    # can be equal!
Question 1 of 4