Vbench performance benchmarks for NumPy

vb_io

cont_assign_complex128

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.complex128).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.complex128).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.complex128)

Benchmark statement

d[...] = 1

Performance graph

_images/cont_assign_complex128.png

cont_assign_complex64

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.complex64).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.complex64).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.complex64)

Benchmark statement

d[...] = 1

Performance graph

_images/cont_assign_complex64.png

cont_assign_float32

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.float32).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.float32).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.float32)

Benchmark statement

d[...] = 1

Performance graph

_images/cont_assign_float32.png

cont_assign_float64

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.float64).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.float64).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.float64)

Benchmark statement

d[...] = 1

Performance graph

_images/cont_assign_float64.png

cont_assign_int16

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.int16).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.int16).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.int16)

Benchmark statement

d[...] = 1

Performance graph

_images/cont_assign_int16.png

cont_assign_int8

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.int8).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.int8).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.int8)

Benchmark statement

d[...] = 1

Performance graph

_images/cont_assign_int8.png

copyto

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.ones(50000)
e = d.copy()
m = d == 1
im = ~m
m8 = m.copy()
m8[::8] = ~(m[::8])
im8 = ~m8

Benchmark statement

np.copyto(d, e)

Performance graph

_images/copyto.png

copyto_8_dense

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.ones(50000)
e = d.copy()
m = d == 1
im = ~m
m8 = m.copy()
m8[::8] = ~(m[::8])
im8 = ~m8

Benchmark statement

np.copyto(d, e, where=im8)

Performance graph

_images/copyto_8_dense.png

copyto_8_sparse

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.ones(50000)
e = d.copy()
m = d == 1
im = ~m
m8 = m.copy()
m8[::8] = ~(m[::8])
im8 = ~m8

Benchmark statement

np.copyto(d, e, where=m8)

Performance graph

_images/copyto_8_sparse.png

copyto_dense

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.ones(50000)
e = d.copy()
m = d == 1
im = ~m
m8 = m.copy()
m8[::8] = ~(m[::8])
im8 = ~m8

Benchmark statement

np.copyto(d, e, where=im)

Performance graph

_images/copyto_dense.png

copyto_sparse

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.ones(50000)
e = d.copy()
m = d == 1
im = ~m
m8 = m.copy()
m8[::8] = ~(m[::8])
im8 = ~m8

Benchmark statement

np.copyto(d, e, where=m)

Performance graph

_images/copyto_sparse.png

memcpy_complex128

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.complex128).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.complex128).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.complex128)

Benchmark statement

d[...] = e_d

Performance graph

_images/memcpy_complex128.png

memcpy_complex64

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.complex64).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.complex64).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.complex64)

Benchmark statement

d[...] = e_d

Performance graph

_images/memcpy_complex64.png

memcpy_float32

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.float32).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.float32).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.float32)

Benchmark statement

d[...] = e_d

Performance graph

_images/memcpy_float32.png

memcpy_float64

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.float64).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.float64).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.float64)

Benchmark statement

d[...] = e_d

Performance graph

_images/memcpy_float64.png

memcpy_int16

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.int16).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.int16).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.int16)

Benchmark statement

d[...] = e_d

Performance graph

_images/memcpy_int16.png

memcpy_int8

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.int8).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.int8).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.int8)

Benchmark statement

d[...] = e_d

Performance graph

_images/memcpy_int8.png

strided_assign_complex128

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.complex128).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.complex128).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.complex128)

Benchmark statement

dflat[::2] = 2

Performance graph

_images/strided_assign_complex128.png

strided_assign_complex64

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.complex64).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.complex64).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.complex64)

Benchmark statement

dflat[::2] = 2

Performance graph

_images/strided_assign_complex64.png

strided_assign_float32

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.float32).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.float32).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.float32)

Benchmark statement

dflat[::2] = 2

Performance graph

_images/strided_assign_float32.png

strided_assign_float64

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.float64).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.float64).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.float64)

Benchmark statement

dflat[::2] = 2

Performance graph

_images/strided_assign_float64.png

strided_assign_int16

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.int16).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.int16).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.int16)

Benchmark statement

dflat[::2] = 2

Performance graph

_images/strided_assign_int16.png

strided_assign_int8

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.int8).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.int8).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.int8)

Benchmark statement

dflat[::2] = 2

Performance graph

_images/strided_assign_int8.png

strided_copy_complex128

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.complex128).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.complex128).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.complex128)

Benchmark statement

d[...] = e.T

Performance graph

_images/strided_copy_complex128.png

strided_copy_complex64

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.complex64).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.complex64).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.complex64)

Benchmark statement

d[...] = e.T

Performance graph

_images/strided_copy_complex64.png

strided_copy_float32

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.float32).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.float32).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.float32)

Benchmark statement

d[...] = e.T

Performance graph

_images/strided_copy_float32.png

strided_copy_float64

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.float64).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.float64).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.float64)

Benchmark statement

d[...] = e.T

Performance graph

_images/strided_copy_float64.png

strided_copy_int16

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.int16).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.int16).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.int16)

Benchmark statement

d[...] = e.T

Performance graph

_images/strided_copy_int16.png

strided_copy_int8

Benchmark setup

import numpy
from tempfile import TemporaryFile

d = numpy.arange(50*500, dtype=numpy.int8).reshape((500,50))
e = numpy.arange(50*500, dtype=numpy.int8).reshape((50,500))
e_d = e.reshape(d.shape)
dflat = numpy.arange(50*500, dtype=numpy.int8)

Benchmark statement

d[...] = e.T

Performance graph

_images/strided_copy_int8.png

vb_savez_squares

Benchmark setup

from numpy_vb_common import squares;
import numpy
from tempfile import TemporaryFile
outfile = TemporaryFile()

Benchmark statement

numpy.savez(outfile, squares)

Performance graph

_images/vb_savez_squares.png