Skip to content

Commit 5173030

Browse files
committed
bench: fix memory leak and use double-precision utility
1 parent c7c8ce4 commit 5173030

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

lib/node_modules/@stdlib/blas/ext/base/zfill/benchmark/benchmark.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
var bench = require( '@stdlib/bench' );
2424
var uniform = require( '@stdlib/random/array/uniform' );
25-
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
25+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2626
var pow = require( '@stdlib/math/base/special/pow' );
2727
var Complex128Array = require( '@stdlib/array/complex128' );
2828
var Complex128 = require( '@stdlib/complex/float64/ctor' );
@@ -70,12 +70,12 @@ function createBenchmark( len ) {
7070
b.tic();
7171
for ( i = 0; i < b.iterations; i++ ) {
7272
zfill( x.length, z, x, 1 );
73-
if ( isnanf( xbuf[ i%(len*2) ] ) ) {
73+
if ( isnan( xbuf[ i%(len*2) ] ) ) {
7474
b.fail( 'should not return NaN' );
7575
}
7676
}
7777
b.toc();
78-
if ( isnanf( xbuf[ i%(len*2) ] ) ) {
78+
if ( isnan( xbuf[ i%(len*2) ] ) ) {
7979
b.fail( 'should not return NaN' );
8080
}
8181
b.pass( 'benchmark finished' );

lib/node_modules/@stdlib/blas/ext/base/zfill/benchmark/benchmark.native.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench' );
2525
var uniform = require( '@stdlib/random/array/uniform' );
26-
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
26+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2727
var pow = require( '@stdlib/math/base/special/pow' );
2828
var Complex128Array = require( '@stdlib/array/complex128' );
2929
var Complex128 = require( '@stdlib/complex/float64/ctor' );
@@ -75,12 +75,12 @@ function createBenchmark( len ) {
7575
b.tic();
7676
for ( i = 0; i < b.iterations; i++ ) {
7777
zfill( x.length, z, x, 1 );
78-
if ( isnanf( xbuf[ i%(len*2) ] ) ) {
78+
if ( isnan( xbuf[ i%(len*2) ] ) ) {
7979
b.fail( 'should not return NaN' );
8080
}
8181
}
8282
b.toc();
83-
if ( isnanf( xbuf[ i%(len*2) ] ) ) {
83+
if ( isnan( xbuf[ i%(len*2) ] ) ) {
8484
b.fail( 'should not return NaN' );
8585
}
8686
b.pass( 'benchmark finished' );

lib/node_modules/@stdlib/blas/ext/base/zfill/benchmark/benchmark.ndarray.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
var bench = require( '@stdlib/bench' );
2424
var uniform = require( '@stdlib/random/array/uniform' );
25-
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
25+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2626
var pow = require( '@stdlib/math/base/special/pow' );
2727
var Complex128Array = require( '@stdlib/array/complex128' );
2828
var Complex128 = require( '@stdlib/complex/float64/ctor' );
@@ -70,12 +70,12 @@ function createBenchmark( len ) {
7070
b.tic();
7171
for ( i = 0; i < b.iterations; i++ ) {
7272
zfill( x.length, z, x, 1, 0 );
73-
if ( isnanf( xbuf[ i%(len*2) ] ) ) {
73+
if ( isnan( xbuf[ i%(len*2) ] ) ) {
7474
b.fail( 'should not return NaN' );
7575
}
7676
}
7777
b.toc();
78-
if ( isnanf( xbuf[ i%(len*2) ] ) ) {
78+
if ( isnan( xbuf[ i%(len*2) ] ) ) {
7979
b.fail( 'should not return NaN' );
8080
}
8181
b.pass( 'benchmark finished' );

lib/node_modules/@stdlib/blas/ext/base/zfill/benchmark/benchmark.ndarray.native.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench' );
2525
var uniform = require( '@stdlib/random/array/uniform' );
26-
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
26+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2727
var pow = require( '@stdlib/math/base/special/pow' );
2828
var Complex128Array = require( '@stdlib/array/complex128' );
2929
var Complex128 = require( '@stdlib/complex/float64/ctor' );
@@ -75,12 +75,12 @@ function createBenchmark( len ) {
7575
b.tic();
7676
for ( i = 0; i < b.iterations; i++ ) {
7777
zfill( x.length, z, x, 1, 0 );
78-
if ( isnanf( xbuf[ i%(len*2) ] ) ) {
78+
if ( isnan( xbuf[ i%(len*2) ] ) ) {
7979
b.fail( 'should not return NaN' );
8080
}
8181
}
8282
b.toc();
83-
if ( isnanf( xbuf[ i%(len*2) ] ) ) {
83+
if ( isnan( xbuf[ i%(len*2) ] ) ) {
8484
b.fail( 'should not return NaN' );
8585
}
8686
b.pass( 'benchmark finished' );

lib/node_modules/@stdlib/blas/ext/base/zfill/benchmark/c/benchmark.length.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ static double rand_double( void ) {
9797
*/
9898
static double benchmark( int iterations, int len ) {
9999
stdlib_complex128_t alpha;
100-
double *x;
101100
double elapsed;
101+
double *x;
102102
double t;
103103
int i;
104104

105-
x = (double *)malloc( len*2 * sizeof( double ) );
105+
x = (double *)malloc( len * 2 * sizeof( double ) );
106106
alpha = stdlib_complex128( 1.0, 0.0 );
107107
for ( i = 0; i < len*2; i+=2 ) {
108108
x[ i ] = ( rand_double()*2.0 ) - 1.0;
@@ -120,6 +120,7 @@ static double benchmark( int iterations, int len ) {
120120
if ( x[ 0 ] != x[ 0 ] ) {
121121
printf( "should not return NaN\n" );
122122
}
123+
free( x );
123124
return elapsed;
124125
}
125126

0 commit comments

Comments
 (0)