Vbench performance benchmarks for NumPy

vb_function_base

argsort

Benchmark setup

import numpy as np
e = np.arange(10000, dtype=np.float32)
o = np.arange(10001, dtype=np.float32)

Benchmark statement

e.argsort()

Performance graph

_images/argsort.png

bincount

Benchmark setup

d = np.arange(80000, dtype=np.intp)

Benchmark statement

np.bincount(d)

Performance graph

_images/bincount.png

bincount_weights

Benchmark setup

d = np.arange(80000, dtype=np.intp); e = d.astype(np.float64)

Benchmark statement

np.bincount(d, weights=e)

Performance graph

_images/bincount_weights.png

median_even

Benchmark setup

import numpy as np
e = np.arange(10000, dtype=np.float32)
o = np.arange(10001, dtype=np.float32)

Benchmark statement

np.median(e)

Performance graph

_images/median_even.png

median_even_inplace

Benchmark setup

import numpy as np
e = np.arange(10000, dtype=np.float32)
o = np.arange(10001, dtype=np.float32)

Benchmark statement

np.median(e, overwrite_input=True)

Performance graph

_images/median_even_inplace.png

median_even_small

Benchmark setup

import numpy as np
e = np.arange(10000, dtype=np.float32)
o = np.arange(10001, dtype=np.float32)

Benchmark statement

np.median(e[:500], overwrite_input=True)

Performance graph

_images/median_even_small.png

median_odd

Benchmark setup

import numpy as np
e = np.arange(10000, dtype=np.float32)
o = np.arange(10001, dtype=np.float32)

Benchmark statement

np.median(o)

Performance graph

_images/median_odd.png

median_odd_inplace

Benchmark setup

import numpy as np
e = np.arange(10000, dtype=np.float32)
o = np.arange(10001, dtype=np.float32)

Benchmark statement

np.median(o, overwrite_input=True)

Performance graph

_images/median_odd_inplace.png

median_odd_small

Benchmark setup

import numpy as np
e = np.arange(10000, dtype=np.float32)
o = np.arange(10001, dtype=np.float32)

Benchmark statement

np.median(o[:500], overwrite_input=True)

Performance graph

_images/median_odd_small.png

percentile

Benchmark setup

import numpy as np
e = np.arange(10000, dtype=np.float32)
o = np.arange(10001, dtype=np.float32)

Benchmark statement

np.percentile(e, [25, 35, 55, 65, 75])

Performance graph

_images/percentile.png

quartile

Benchmark setup

import numpy as np
e = np.arange(10000, dtype=np.float32)
o = np.arange(10001, dtype=np.float32)

Benchmark statement

np.percentile(e, [25, 75])

Performance graph

_images/quartile.png

select

Benchmark setup

d = np.arange(20000); e = d.copy();cond = [d > 4, d < 2]

Benchmark statement

np.select(cond, [d, e])

Performance graph

_images/select.png

select_larger

Benchmark setup

d = np.arange(20000); e = d.copy();cond = [d > 4, d < 2] * 10

Benchmark statement

np.select(cond, [d, e] * 10)

Performance graph

_images/select_larger.png

sort

Benchmark setup

import numpy as np
e = np.arange(10000, dtype=np.float32)
o = np.arange(10001, dtype=np.float32)

Benchmark statement

np.sort(e)

Performance graph

_images/sort.png

sort_inplace

Benchmark setup

import numpy as np
e = np.arange(10000, dtype=np.float32)
o = np.arange(10001, dtype=np.float32)

Benchmark statement

e.sort()

Performance graph

_images/sort_inplace.png

where_1

Benchmark setup

d = np.arange(20000); cond = d > 5000

Benchmark statement

np.where(cond)

Performance graph

_images/where_1.png

where_2

Benchmark setup

d = np.arange(20000); e = d.copy(); cond = d > 5000

Benchmark statement

np.where(cond, d, e)

Performance graph

_images/where_2.png

where_2_broadcast

Benchmark setup

d = np.arange(20000); cond = d > 5000

Benchmark statement

np.where(cond, d, 0)

Performance graph

_images/where_2_broadcast.png