Skip to content

A simple python package to test the computation speed of different expressions.

License

Notifications You must be signed in to change notification settings

piano-miles/comptester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Comptester

A simple python package to test the computation speed of different expressions.

  • E.g., does x*x*x*x*x*x or x**6 run faster?

Contents

Installation

To install this package, run the install script (or run the commands in your terminal).

Usage

See the Example section below for an in-depth example for how to use this package.

  • The test method will perform a test given two expressions, an iteration count, and a sample count.
  • The tprint method will print the data from the test.
  • The plot method will plot the data so you can see visually how the expressions compare against each other and a control.

Example

from comptester import tester

# Defining parameters
multiplication = "x*x*x*x*x*x"  # Compute x^6 by multiplication
power = "x**6"                  # Compute x^6 by power
iteration_count = 100000        # Number of times each expression is tested in a sample
samples = 100                   # Number of samples to collect

# Run the test and store it in the 'test' variable
test = tester.test(
    expr1=multiplication,
    expr2=power,
    iters=iteration_count,
    sample_count=samples,
)

# Print the test results to the console
# tester.tprint(test)

# Plot the test results
tester.plot(test)

Example plot

The example code above produces the following plot:

Example plot

About

A simple python package to test the computation speed of different expressions.

Resources

License

Stars

Watchers

Forks

Packages

No packages published