A stupid simple memory profiler.
Project description
profile-this
Sometimes you need sophisticated line-by-line profiling for optimizing your Python code. Other times, you just want a quick and basic memory profile chart.
There are plenty of tools for the former use-case, e.g. py-spy or vprof. But not many (or any) tools for the latter use-case.
profile-this is a stupid simple memory profiler for people who just want a basic memory profiling plot without writing one from scratch.
Links
Example
Install it like this:
pip install profile-this
Do this:
from random import randint
from profile_this import ProfileThis
def func(n=10_000_000):
return sum([randint(0, i + 1) for i in range(n)])
profiler = ProfileThis()
profiler.start()
func()
profiler.stop()
profiler.plot(
title="Profile for func", path="docs/func.png"
)
Or, equivalently, do this instead:
with ProfileThis() as profiler:
func()
profiler.plot(
title="Profile for func",
path="docs/func.png",
)
To get this:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file profile_this-0.1.4.tar.gz.
File metadata
- Download URL: profile_this-0.1.4.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/22.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4a67606ae45258b4d83b7ef0eb03720a8863a61bf6e3792ec6adceeba9a3f1f
|
|
| MD5 |
111b05d0805a70f9b022ceca41341ecf
|
|
| BLAKE2b-256 |
c89e1ec30f45a86296fb06e8820dc72c07e1b9b5c9d5cd781756f7ae9d6311bc
|
File details
Details for the file profile_this-0.1.4-py3-none-any.whl.
File metadata
- Download URL: profile_this-0.1.4-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/22.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e1e2b4ba765ac431ec92a96c745603d713e8693ffd228baac6019a98cc4565e
|
|
| MD5 |
443de6ed170f3419a4d10a4aa5952e50
|
|
| BLAKE2b-256 |
a47f8afed49ef449e781183fb281cc6338c3547354bd46a2182596ba2ed1482e
|