Skip to content

Instantly share code, notes, and snippets.

@amad
Created March 21, 2019 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amad/e2b77d341864c86917f71c4ff06a206e to your computer and use it in GitHub Desktop.
Save amad/e2b77d341864c86917f71c4ff06a206e to your computer and use it in GitHub Desktop.
import numpy
import perfplot
perfplot.show(
setup=lambda n: numpy.random.randint(0, 1000, n),
kernels=[
lambda a: a[::-1],
lambda a: numpy.ascontiguousarray(a[::-1]),
lambda a: numpy.fliplr([a])[0]
],
labels=['a[::-1]', 'ascontiguousarray(a[::-1])', 'fliplr'],
n_range=[2**k for k in range(25)],
xlabel='len(a)',
logx=True,
logy=True,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment