diff --git a/lib/node_modules/@stdlib/number/int32/base/mul/benchmark/benchmark.js b/lib/node_modules/@stdlib/number/int32/base/mul/benchmark/benchmark.js index 71dd50ce207e..23d55712f3d3 100644 --- a/lib/node_modules/@stdlib/number/int32/base/mul/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/number/int32/base/mul/benchmark/benchmark.js @@ -21,8 +21,8 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var minstd = require( '@stdlib/random/base/minstd' ); -var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var format = require( '@stdlib/string/format' ); var pkg = require( './../package.json' ).name; var imul = require( './../lib' ); var polyfill = require( './../lib/polyfill.js' ); @@ -35,59 +35,68 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = discreteUniform( 100, 0, 10, { + 'dtype': 'int32' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = minstd(); - y = imul( x|0, x|0 ); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); + y = imul( x[ i%x.length ], 10 ); + if ( y > 100 ) { + b.fail( 'unexpected result' ); } } b.toc(); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); + if ( y > 100 ) { + b.fail( 'unexpected result' ); } b.pass( 'benchmark finished' ); b.end(); }); -bench( pkg+'::polyfill', function benchmark( b ) { +bench( format( '%s::polyfill', pkg ), function benchmark( b ) { var x; var y; var i; + x = discreteUniform( 100, 0, 10, { + 'dtype': 'int32' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = minstd(); - y = polyfill( x|0, x|0 ); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); + y = polyfill( x[ i%x.length ], 10 ); + if ( y > 100 ) { + b.fail( 'unexpected result' ); } } b.toc(); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); + if ( y > 100 ) { + b.fail( 'unexpected result' ); } b.pass( 'benchmark finished' ); b.end(); }); -bench( pkg+'::naive_multiplication', function benchmark( b ) { +bench( format( '%s::inline', pkg ), function benchmark( b ) { var x; var y; var i; + x = discreteUniform( 100, 0, 10, { + 'dtype': 'int32' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = minstd(); - y = ( x|0 ) * ( x|0 ); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); + y = ( ( x[ i%x.length ] ) * 5 ) | 0; + if ( y > 100 ) { + b.fail( 'unexpected result' ); } } b.toc(); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); + if ( y > 100 ) { + b.fail( 'unexpected result' ); } b.pass( 'benchmark finished' ); b.end();