Skip to content

Instantly share code, notes, and snippets.

@nschloe
Created August 9, 2021 08:23
Show Gist options
  • Save nschloe/fffb4f8ec2622fd2e87408996b9dde4e to your computer and use it in GitHub Desktop.
Save nschloe/fffb4f8ec2622fd2e87408996b9dde4e to your computer and use it in GitHub Desktop.
numpy array scalar division
import numpy as np
import perfplot
def mult(x):
return x * (1.0 / np.pi)
def div(x):
return x / np.pi
b = perfplot.bench(
setup=np.random.rand, kernels=[mult, div], n_range=[2 ** k for k in range(25)]
)
b.save("out.png")
b.show()
@nschloe
Copy link
Author

nschloe commented Aug 9, 2021

out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment