Skip to main content

Profile a function using a simple decorator

Project description

function_profile decorator

Provides decorator for time and memory profiling of functions.

Metrics:

  • time - time for a single function call

  • memory - peak memory used by the function. The peak memory is the difference between the starting minimum value, and the highest value.

Usage:

from function_profile_decorator import profile

@profile(time_prof=True, mem_prof=True)
def factoriel_loop(n: int) -> int:
    """Calculate factoriel non-recursive."""
    fac: int = 1
    for i in range(1, n + 1):
        fac = fac * i
    return fac

factoriel_loop(n=100)

Output:

factoriel_loop(, n=100)

Time 0.00001450

Memory 0.0546875

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

func-profile-decor-0.1.7.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

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

func_profile_decor-0.1.7-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file func-profile-decor-0.1.7.tar.gz.

File metadata

  • Download URL: func-profile-decor-0.1.7.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

File hashes

Hashes for func-profile-decor-0.1.7.tar.gz
Algorithm Hash digest
SHA256 3db63e4f9937aea566f337505770f01b54a69762f3a2fde0cbf6763c87a02cdb
MD5 cbf7c8c2bc7135c224c769b6a1c25b67
BLAKE2b-256 352a8b22137a502ee1314901d9a98d55d3d8d00c9e730a31f23800e659c3951f

See more details on using hashes here.

File details

Details for the file func_profile_decor-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: func_profile_decor-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

File hashes

Hashes for func_profile_decor-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 189fb9664f0db0cac91ec01fcb7f6cf68938e73de9c46c9590e8052eec87bfac
MD5 acb2e45a33db0477833a501d236a992f
BLAKE2b-256 ed92062606c41209d3b6725eccb8539c0f05705e0d11f1dce454ab7eab846361

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