Skip to content

Commit 51be29d

Browse files
committed
bench: update benchmarks
1 parent 3410526 commit 51be29d

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

lib/node_modules/@stdlib/math/base/special/riemann-zeta/benchmark/benchmark.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench' );
24-
var randu = require( '@stdlib/random/base/randu' );
24+
var randu = require( '@stdlib/random/array/uniform' );
2525
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2626
var EPS = require( '@stdlib/constants/float64/eps' );
2727
var pkg = require( './../package.json' ).name;
@@ -35,10 +35,11 @@ bench( pkg, function benchmark( b ) {
3535
var y;
3636
var i;
3737

38+
x = randu( 100, 1.0 + EPS, 57.0 + EPS );
39+
3840
b.tic();
3941
for ( i = 0; i < b.iterations; i++ ) {
40-
x = ( randu()*56.0 ) + 1.0 + EPS;
41-
y = zeta( x );
42+
y = zeta( x[ i % x.length ] );
4243
if ( isnan( y ) ) {
4344
b.fail( 'should not return NaN' );
4445
}

lib/node_modules/@stdlib/math/base/special/riemann-zeta/benchmark/benchmark.native.js

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

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench' );
25-
var randu = require( '@stdlib/random/base/randu' );
25+
var randu = require( '@stdlib/random/array/uniform' );
2626
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2727
var EPS = require( '@stdlib/constants/float64/eps' );
2828
var tryRequire = require( '@stdlib/utils/try-require' );
@@ -44,10 +44,11 @@ bench( pkg+'::native', opts, function benchmark( b ) {
4444
var y;
4545
var i;
4646

47+
x = randu( 100, 1.0 + EPS, 57.0 + EPS );
48+
4749
b.tic();
4850
for ( i = 0; i < b.iterations; i++ ) {
49-
x = ( randu() * 56.0 ) + 1.0 + EPS;
50-
y = zeta( x );
51+
y = zeta( x[ i % x.length ] );
5152
if ( isnan( y ) ) {
5253
b.fail( 'should not return NaN' );
5354
}

lib/node_modules/@stdlib/math/base/special/riemann-zeta/benchmark/c/cephes/benchmark.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,18 @@ static double rand_double( void ) {
9595
*/
9696
static double benchmark( void ) {
9797
double elapsed;
98-
double x;
98+
double x[ 100 ];
9999
double y;
100100
double t;
101101
int i;
102102

103+
for ( i = 0; i < 100; i++ ) {
104+
x[ i ] = ( 56.0 * rand_double() ) + 1.1;
105+
}
106+
103107
t = tic();
104108
for ( i = 0; i < ITERATIONS; i++ ) {
105-
x = ( 56.0*rand_double() ) + 1.1;
106-
y = zeta( x, 1.0 );
109+
y = zeta( x[ i % 100 ], 1.0 );
107110
if ( y != y ) {
108111
printf( "should not return NaN\n" );
109112
break;

lib/node_modules/@stdlib/math/base/special/riemann-zeta/benchmark/c/native/benchmark.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,18 @@ static double rand_double( void ) {
9191
*/
9292
static double benchmark( void ) {
9393
double elapsed;
94-
double x;
94+
double x[ 100 ];
9595
double y;
9696
double t;
9797
int i;
9898

99+
for ( i = 0; i < 100; i++ ) {
100+
x[ i ] = ( 56.0 * rand_double() ) + 1.0;
101+
}
102+
99103
t = tic();
100104
for ( i = 0; i < ITERATIONS; i++ ) {
101-
x = ( 56.0 * rand_double() ) + 1.0;
102-
y = stdlib_base_zeta( x );
105+
y = stdlib_base_zeta( x[ i % 100 ] );
103106
if ( y != y ) {
104107
printf( "should not return NaN\n" );
105108
break;

0 commit comments

Comments
 (0)