Skip to content

Commit 1f951f5

Browse files
committed
refactor: apply suggestions from code review
1 parent 4e90719 commit 1f951f5

File tree

1 file changed

+5
-8
lines changed
  • lib/node_modules/@stdlib/ndarray/base/nullary-strided1d-dispatch-factory/benchmark

1 file changed

+5
-8
lines changed

lib/node_modules/@stdlib/ndarray/base/nullary-strided1d-dispatch-factory/benchmark/benchmark.assign.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' );
2525
var pow = require( '@stdlib/math/base/special/pow' );
2626
var dtypes = require( '@stdlib/array/dtypes' );
2727
var uniform = require( '@stdlib/random/array/uniform' );
28-
var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
2928
var ndarray = require( '@stdlib/ndarray/base/ctor' );
3029
var gsorthp = require( '@stdlib/blas/ext/base/ndarray/gsorthp' );
3130
var pkg = require( './../package.json' ).name;
@@ -60,9 +59,7 @@ function createBenchmark( len ) {
6059
'dtype': 'float64'
6160
});
6261
x = new ndarray( 'float64', x, [ len ], [ 1 ], 0, 'row-major' );
63-
o = scalar2ndarray( 1.0, {
64-
'dtype': 'generic'
65-
});
62+
o = new ndarray( 'generic', [ 1 ], [], [ 1 ], 0, 'row-major' );
6663

6764
return benchmark;
6865

@@ -73,18 +70,18 @@ function createBenchmark( len ) {
7370
* @param {Benchmark} b - benchmark instance
7471
*/
7572
function benchmark( b ) {
76-
var o;
73+
var out;
7774
var i;
7875

7976
b.tic();
8077
for ( i = 0; i < b.iterations; i++ ) {
81-
o = nullary.assign( x, o );
82-
if ( typeof o !== 'object' ) {
78+
out = nullary.assign( x, o );
79+
if ( typeof out !== 'object' ) {
8380
b.fail( 'should return an ndarray' );
8481
}
8582
}
8683
b.toc();
87-
if ( isnan( o.get( i%len ) ) ) {
84+
if ( isnan( out.get( i%len ) ) ) {
8885
b.fail( 'should not return NaN' );
8986
}
9087
b.pass( 'benchmark finished' );

0 commit comments

Comments
 (0)