Skip to main content

An Easy Way To Benchmark Your Python Code

Project description

Raptor

A Easy Way To Benchmark Your Code.

How To Use It

Step 1: First You Will Need To Create A Benchmark File For Your Project

"""to_benchmark.py"""

#Add All Your Setup
import math


#Write Your Benchmarking Functions
def bench_square_root():
    """Name Your Function Starting With bench. Or Raptor Wont Detect It
    Also the function should not take any arguments"""
    return math.sqrt(25)

def bench_multiply():
    return 5 ** 25

Step 2: Download raptor.py And Keep It Inside Your Working Directory.

Then, Run This In Your Terminal

NOTICE: The -t Argument Takes An Integer Which Tells Raptor How Many Times Should Each Benchmarking Function Run

raptor.py to_benchmark.py -t 10000

Step 3: See The Output. Voilaaaaa!!!!!!!!!

Output

========== Bench Marking ===========
[bench_square_root] Took 0.0025385 Seconds For 10000 Run(s)
[bench_multiply] Took 0.0010813999999999997 Seconds For 10000 Run(s)

Pypi

I will soon upload it to pypi
Therefore you will only be required to pip install it

Future Features

  1. I want to add an history, which can show you how much faster or slower your program has gotten
  2. I want to add colored output
  3. I want to add better exception handling

Built With

Raptor Uses Timeit Module To Benchmark Your Code

Author

Roshan Jignesh Mehta - sonicroshan122@gmail.com

Project details


Download files

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

Files for python-raptor, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size python_raptor-0.2-py3-none-any.whl (15.4 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size python_raptor-0.2.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page