Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -21,8 +21,7 @@
// MODULES //

var bench = require( '@stdlib/bench' );
var Float64Array = require( '@stdlib/array/float64' );
var uniform = require( '@stdlib/random/base/uniform' );
var uniform = require( '@stdlib/random/array/uniform' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var pkg = require( './../package.json' ).name;
var median = require( './../lib' );
Expand All @@ -38,13 +37,12 @@ bench( pkg, function benchmark( b ) {

len =100;
lambda = new Float64Array( len );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
len =100;
lambda = new Float64Array( len );

won't be needing the Float64Array module so better to remove it

for ( i = 0; i < len; i++ ) {
lambda[ i ] = uniform( 1.0, 10.0);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

please remove this extra line.
Same for the native file.

lambda = uniform(100, 1.0, 10.0);
Copy link
Member

@Neerajpathak07 Neerajpathak07 Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
lambda = uniform(100, 1.0, 10.0);
lambda = uniform( 100, 0.1, 10.0 );

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need the same change for the native version as well.


b.tic();
for ( i = 0; i < b.iterations; i++ ) {
y = median( lambda[ i % len ] );
y = median( lambda[ i % lambda.length ] );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,13 @@ bench( pkg+'::native', opts, function benchmark( b ) {
var i;

len = 100;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here as well!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll also want to remove

var uniform = require( '@stdlib/random/base/uniform' );

and add

var uniform = require( '@stdlib/random/array/uniform' );

lambda = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
lambda[ i ] = uniform( 1.0, 10.0 );
}

lambda = uniform(100, 0.1, 10.0);


b.tic();
for ( i = 0; i < b.iterations; i++ ) {
y = median( lambda[ i % len ] );
y = median( lambda[ i % lambda.length ] );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
Expand Down