Quantcast
Channel: Planet Python
Viewing all articles
Browse latest Browse all 23054

Python⇒Speed: Invasive procedures: Python affordances for performance measurement

$
0
0

When your Python code is too slow, you need to identify the bottleneck that’s causing it: you need to understand what your code is doing. Luckily, beyond pre-existing profiling tools, there are also a variety of ways you can poke and prod Python programs to get a better understanding of what they’re doing internally.

This allows you to do one-time introspection, add profiling facilities to your program that you can turn on and off, build custom tools, and in general get a better understand of what your program is doing.

Some of these affordances are quite awful, but that’s OK! Performance debugging is a different kind of coding than writing long-term maintainable code.

In this article we’ll cover:

  1. Runtime object mutation (“monkey patching”).
  2. Code patching.
  3. Runtime mutation of C types.
  4. Audit hooks.
  5. sys._current_frames().
  6. Profiling and tracing hooks.
  7. And more!
Read more...

Viewing all articles
Browse latest Browse all 23054

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>