npstreams.benchmark(funcs=[<function average>, <function mean>, <function std>, <function sum>, <function prod>], ufuncs=[<ufunc 'add'>, <ufunc 'multiply'>, <ufunc 'power'>, <ufunc 'true_divide'>, <ufunc 'remainder'>], shapes=[(4, 4), (8, 8), (16, 16), (64, 64)], file=None)

Benchmark npstreams against numpy and print the results.

There are two categories of benchmarks. The first category compares NumPy functions against npstreams versions of the same functions. The second category compares NumPy universal functions against dynamically-generated npstreams versions of those same universal functions.

All benchmarks compare a reduction operation on a stream of arrays of varying sizes. The sequence length is fixed.

New in version 1.5.2.

  • funcs (iterable of NumPy functions, optional) – NumPy functions to compare. An equivalent must exist in npstreams, e.g. np.average and npstreams.average . Functions without equivalents will be skipped.

  • ufuncs (iterable of NumPy ufunc, optional) – Invalid ufuncs (e.g. non-binary ufuncs) will be skipped.

  • shapes (iterable of tuples, optional) – Shapes of arrays to test. Streams of random numbers will be generated with arrays of those shapes. The sequence lengths are fixed.

  • file (file-like or None, optional) – File to which the benchmark results will be written. If None, sys.stdout will be used.