Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
var bench = require( '@stdlib/bench' );
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
var pow = require( '@stdlib/math/base/special/pow' );
var randu = require( '@stdlib/random/base/randu' );
var format = require( '@stdlib/string/format' );
var pkg = require( './../package.json' ).name;
var contains = require( './../lib' );

Expand Down Expand Up @@ -61,7 +61,7 @@ function createBenchmark( fcn, len ) {
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
// Note: we are testing the worst case scenario where a function must scan the entire array before finding a value.
x[ len-2 ] = randu();
x[ len-2 ] -= 1;
bool = fcn( x, len-1 );
if ( typeof bool !== 'boolean' ) {
b.fail( 'should return a boolean' );
Expand Down Expand Up @@ -98,7 +98,7 @@ function main() {
len = pow( 10, i );

f = createBenchmark( contains, len );
bench( pkg+':len='+len, f );
bench( format( '%s:len=%d', pkg, len ), f );
}
}

Expand Down
Loading