Skip to main content

A stupid simple memory profiler.

Project description

profile-this

Sometimes you need sophisticated line-by-line profiling for optimizing my Python code. Other times, you just want a basic temporal line plot showing memory allocation.

There are plenty of tools for the former use-case, e.g. py-spy or vprof. But I am not aware of any tools for the latter use-case -- probably because no one wants to release something so basic.

profile-this is a stupid simple memory profiler for people who just want a basic memory profiling plot without writing one from scratch.

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"
)

To get this:

func image

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

profile_this-0.1.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

profile_this-0.1.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file profile_this-0.1.1.tar.gz.

File metadata

  • Download URL: profile_this-0.1.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/22.6.0

File hashes

Hashes for profile_this-0.1.1.tar.gz
Algorithm Hash digest
SHA256 10ea74d4c69d03b6431c805d6faacefcfa71eece94f00dbd091d8419f04dcfa1
MD5 feab83a6721becc47440602bea30b2e7
BLAKE2b-256 6686ee3cef2e7979f3cb658329282eef473fbeb45d6a5ebc313f9a5ee49fbf8f

See more details on using hashes here.

File details

Details for the file profile_this-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: profile_this-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.6 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

Hashes for profile_this-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 81104a83ab262a527a5099ea350b2b980ab0773c171d50a0706adcfee79ac9b4
MD5 ab5f0187ff781273e31dab3165f4a7c2
BLAKE2b-256 eac4d7d83dd04689589f366459f59eee264c6d4c5a1c11348c0bd7e3cd65ad06

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page