Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Profiling Python Code for Performance
Rudolf Olah
Rudolf Olah

Posted on • Edited on

     

Profiling Python Code for Performance

Here are a few tools that are actively maintained that can help you understand and profile the performance of your Python code, from Django apps to Celery workers to desktop GUI apps:

cProfile and tracemalloc are included in the Python Standard Library

The others are libraries that are actively maintained and can be used to diagnose various performance issues.

Memray is great and it works with Python threads and it produces flame graphs for the profiling reports. There's a plugin forpytest that can run Memray so you can profile your test code and the code running within the tests.

Guppy3 is a neat tool for diagnosing memory leak issues.

Fil is a memory profiler that works on Linux and MacOS, that produces flame graphs.

Check out the repo for code examples:https://github.com/rudolfolah/profiling-code/tree/main/python

I've previously written about how to profile performance for React JavaScript frontend builds over here:https://rudolfolah.com/profiling-webpack-node-react/

Cover image byMax Böttinger onUnsplash

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Eng Manager / Staff Software Eng
  • Location
    Canada
  • Work
    Eng Manager / Staff Software Eng
  • Joined

More fromRudolf Olah

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp