Skip to content

Commit 9cd273a

Browse files
committed
bench: fix mutation bug
1 parent a35f2d1 commit 9cd273a

File tree

1 file changed

+8
-4
lines changed
  • lib/node_modules/@stdlib/array/base/put/benchmark

1 file changed

+8
-4
lines changed

lib/node_modules/@stdlib/array/base/put/benchmark/benchmark.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,17 @@ var put = require( './../lib' );
3030
// MAIN //
3131

3232
bench( pkg+'::no_broadcasting:len=100', function benchmark( b ) {
33+
var idx;
3334
var x;
3435
var i;
3536
var v;
3637

37-
x = zeroTo( 99 );
38+
x = zeroTo( 100 );
39+
idx = zeroTo( 100 );
3840

3941
b.tic();
4042
for ( i = 0; i < b.iterations; i++ ) {
41-
v = put( x, x, x, 'throw' );
43+
v = put( x, idx, x, 'throw' );
4244
if ( typeof v !== 'object' ) {
4345
b.fail( 'should return an array' );
4446
}
@@ -52,15 +54,17 @@ bench( pkg+'::no_broadcasting:len=100', function benchmark( b ) {
5254
});
5355

5456
bench( pkg+'::broadcasting:len=100', function benchmark( b ) {
57+
var idx;
5558
var x;
5659
var i;
5760
var v;
5861

59-
x = zeroTo( 99 );
62+
x = zeroTo( 100 );
63+
idx = zeroTo( 100 );
6064

6165
b.tic();
6266
for ( i = 0; i < b.iterations; i++ ) {
63-
v = put( x, x, [ i ], 'throw' );
67+
v = put( x, idx, [ i ], 'throw' );
6468
if ( typeof v !== 'object' ) {
6569
b.fail( 'should return an array' );
6670
}

0 commit comments

Comments
 (0)