Skip to main content

A simple but robust package to time any function

Project description

Package Description

timeN is a simple package that contains a customizable @timen decorator which times how long it takes (in milliseconds) for the decorated function to run n times

Usage

The timen decorator is quite simple to use. it can be imported by simply importing the timeN package with

import timeN

From there, the timeN decorator can be used like any other decorator, with the exception that you must end the decorator in parentheses since it takes optional parameters

@timeN()
def foo():
    print("Hello World")

Output:

Hello World
...
Hello World
foo took 2.0 milliseconds to run 10 times

The 2 optional parameters are: n (number of times to run the function) and round_to (number decimal places to round the final result to).

@timeN(100, 5)
def foo():
    print("Hello World")

Output:

Hello World
...
Hello World
foo took 11.99365 milliseconds to run 100 times

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

timeN-1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

timeN-1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file timeN-1.tar.gz.

File metadata

  • Download URL: timeN-1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for timeN-1.tar.gz
Algorithm Hash digest
SHA256 e027b171bff6dd585f419d66a7e459c0423ef28938967bb2071a661cc7786274
MD5 b96165bca54558a79bfe2a512a801e5c
BLAKE2b-256 13973687b7d4964fdf95c2d81999d8c316da4d75512729a76f445620177b8cc6

See more details on using hashes here.

File details

Details for the file timeN-1-py3-none-any.whl.

File metadata

  • Download URL: timeN-1-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for timeN-1-py3-none-any.whl
Algorithm Hash digest
SHA256 2e15550973db1a9e1d1e814ce09b576bff94c5c73d361b6622e08d785b25c769
MD5 7aef1a322475c4076958e85b17a82824
BLAKE2b-256 c18642d5d7a548a6a65619dcd79444ac481a4e0ed414717887d842c434496d4d

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