Skip to content

Commit cfd416e

Browse files
committed
Auto-generated commit
1 parent ea583ff commit cfd416e

File tree

9 files changed

+54
-37
lines changed

9 files changed

+54
-37
lines changed

.github/.keepalive

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2025-04-07)
7+
## Unreleased (2025-04-11)
88

99
<section class="commits">
1010

1111
### Commits
1212

1313
<details>
1414

15+
- [`0283c27`](https://github.com/stdlib-js/stdlib/commit/0283c27a0c7795f636dddb096ed5d59e1597b0ad) - **bench:** update random value generation [(#6649)](https://github.com/stdlib-js/stdlib/pull/6649) _(by Harsh)_
1516
- [`ff25e13`](https://github.com/stdlib-js/stdlib/commit/ff25e1324e1507cc076078e82badce7fdf7915f6) - **docs:** remove excess whitespace _(by Philipp Burckhardt)_
1617

1718
</details>
@@ -24,8 +25,9 @@
2425

2526
### Contributors
2627

27-
A total of 1 person contributed to this release. Thank you to this contributor:
28+
A total of 2 people contributed to this release. Thank you to the following contributors:
2829

30+
- Harsh
2931
- Philipp Burckhardt
3032

3133
</section>

CONTRIBUTORS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Joris Labie <joris.labie1@gmail.com>
7777
Justin Dennison <justin1dennison@gmail.com>
7878
Justyn Shelby <96994781+ShelbyJustyn@users.noreply.github.com>
7979
Karan Anand <anandkarancompsci@gmail.com>
80+
Karan Yadav <77043443+karanBRAVO@users.noreply.github.com>
8081
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
8182
Kaushikgtm <162317291+Kaushikgtm@users.noreply.github.com>
8283
Kavyansh-Bagdi <153486713+Kavyansh-Bagdi@users.noreply.github.com>
@@ -86,6 +87,7 @@ Krishnendu Das <86651039+itskdhere@users.noreply.github.com>
8687
Kshitij-Dale <152467202+Kshitij-Dale@users.noreply.github.com>
8788
Lovelin Dhoni J B <100030865+lovelindhoni@users.noreply.github.com>
8889
MANI <77221000+Eternity0207@users.noreply.github.com>
90+
Mahfuza Humayra Mohona <mhmohona@gmail.com>
8991
Manik Sharma <maniksharma.rke@gmail.com>
9092
Manvith M <148960168+manvith2003@users.noreply.github.com>
9193
Marcus Fantham <mfantham@users.noreply.github.com>
@@ -118,6 +120,7 @@ Prashant Kumar Yadav <144602492+0PrashantYadav0@users.noreply.github.com>
118120
PrathamBhamare <164445568+PrathamBhamare@users.noreply.github.com>
119121
Pratik Singh <97464067+Pratik772846@users.noreply.github.com>
120122
Pratyush Kumar Chouhan <pratyushkumar0308@gmail.com>
123+
Pravesh Kunwar <praveshkunwar04@gmail.com>
121124
Priyansh Prajapati <88396544+itsspriyansh@users.noreply.github.com>
122125
Priyanshu Agarwal <113460573+AgPriyanshu18@users.noreply.github.com>
123126
Pulkit Gupta <65711278+pulkitgupta2@users.noreply.github.com>

benchmark/benchmark.js

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

2323
var bench = require( '@stdlib/bench-harness' );
24-
var randu = require( '@stdlib/random-base-randu' );
24+
var uniform = require( '@stdlib/random-array-uniform' );
2525
var isnan = require( '@stdlib/math-base-assert-is-nan' );
2626
var pkg = require( './../package.json' ).name;
2727
var max = require( './../lib' );
@@ -30,16 +30,21 @@ var max = require( './../lib' );
3030
// MAIN //
3131

3232
bench( pkg, function benchmark( b ) {
33+
var opts;
3334
var x;
3435
var y;
3536
var z;
3637
var i;
3738

39+
opts = {
40+
'dtype': 'float64'
41+
};
42+
x = uniform( 100, -5000.0, 5000.0, opts );
43+
y = uniform( 100, -5000.0, 5000.0, opts );
44+
3845
b.tic();
3946
for ( i = 0; i < b.iterations; i++ ) {
40-
x = ( randu()*10000.0 ) - 5000.0;
41-
y = ( randu()*10000.0 ) - 5000.0;
42-
z = max( x, y );
47+
z = max( x[ i%x.length ], y[ i%y.length ] );
4348
if ( isnan( z ) ) {
4449
b.fail( 'should not return NaN' );
4550
}

benchmark/benchmark.native.js

Lines changed: 9 additions & 4 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-harness' );
25-
var randu = require( '@stdlib/random-base-randu' );
25+
var uniform = require( '@stdlib/random-array-uniform' );
2626
var isnan = require( '@stdlib/math-base-assert-is-nan' );
2727
var tryRequire = require( '@stdlib/utils-try-require' );
2828
var pkg = require( './../package.json' ).name;
@@ -39,16 +39,21 @@ var opts = {
3939
// MAIN //
4040

4141
bench( pkg+'::native', opts, function benchmark( b ) {
42+
var opts;
4243
var x;
4344
var y;
4445
var z;
4546
var i;
4647

48+
opts = {
49+
'dtype': 'float64'
50+
};
51+
x = uniform( 100, -1000.0, 1000.0, opts );
52+
y = uniform( 100, -1000.0, 1000.0, opts );
53+
4754
b.tic();
4855
for ( i = 0; i < b.iterations; i++ ) {
49-
x = ( randu()*2000.0 ) - 1000.0;
50-
y = ( randu()*2000.0 ) - 1000.0;
51-
z = max( x, y );
56+
z = max( x[ i%x.length ], y[ i%y.length ] );
5257
if ( isnan( z ) ) {
5358
b.fail( 'should not return NaN' );
5459
}

benchmark/c/native/benchmark.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,20 @@ static double rand_double( void ) {
9191
*/
9292
static double benchmark( void ) {
9393
double elapsed;
94+
double x[ 100 ];
95+
double y[ 100 ];
9496
double t;
95-
double x;
96-
double y;
9797
double z;
9898
int i;
9999

100+
for ( i = 0; i < 100; i++ ) {
101+
x[ i ] = ( 2000.0*rand_double() ) - 1000.0;
102+
y[ i ] = ( 2000.0*rand_double() ) - 1000.0;
103+
}
104+
100105
t = tic();
101106
for ( i = 0; i < ITERATIONS; i++ ) {
102-
x = ( 2000.0*rand_double() ) - 1000.0;
103-
y = ( 2000.0*rand_double() ) - 1000.0;
104-
z = stdlib_base_fast_max( x, y );
107+
z = stdlib_base_fast_max( x[ i%100 ], y[ i%100 ] );
105108
if ( z != z ) {
106109
printf( "should not return NaN\n" );
107110
break;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
"@stdlib/math-base-assert-is-nan": "^0.2.2",
4949
"@stdlib/math-base-assert-is-negative-zero": "^0.2.2",
5050
"@stdlib/math-base-assert-is-positive-zero": "^0.2.2",
51+
"@stdlib/random-array-uniform": "^0.2.1",
5152
"@stdlib/random-base-minstd-shuffle": "^0.2.1",
52-
"@stdlib/random-base-randu": "^0.2.1",
5353
"@stdlib/utils-try-require": "^0.2.2",
5454
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
5555
"istanbul": "^0.4.1",

test/test.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ tape( 'the function may not return `NaN` if provided a `NaN`', function test( t
4545
var v;
4646

4747
v = max( NaN, 3.14 );
48-
t.strictEqual( v, 3.14, 'returns 3.14' );
48+
t.strictEqual( v, 3.14, 'returns expected value' );
4949

5050
v = max( 3.14, NaN );
51-
t.strictEqual( isnan( v ), true, 'returns NaN' );
51+
t.strictEqual( isnan( v ), true, 'returns expected value' );
5252

5353
t.end();
5454
});
@@ -57,10 +57,10 @@ tape( 'the function returns `+infinity` if provided `+infinity`', function test(
5757
var v;
5858

5959
v = max( PINF, 3.14 );
60-
t.strictEqual( v, PINF, 'returns +infinity' );
60+
t.strictEqual( v, PINF, 'returns expected value' );
6161

6262
v = max( 3.14, PINF );
63-
t.strictEqual( v, PINF, 'returns +infinity' );
63+
t.strictEqual( v, PINF, 'returns expected value' );
6464

6565
t.end();
6666
});
@@ -69,16 +69,16 @@ tape( 'the function may not return a correctly signed zero', function test( t )
6969
var v;
7070

7171
v = max( +0.0, -0.0 );
72-
t.strictEqual( isNegativeZero( v ), true, 'returns -0' );
72+
t.strictEqual( isNegativeZero( v ), true, 'returns expected value' );
7373

7474
v = max( -0.0, +0.0 );
75-
t.strictEqual( isNegativeZero( v ), false, 'does not return -0' );
75+
t.strictEqual( isNegativeZero( v ), false, 'returns expected value' );
7676

7777
v = max( -0.0, -0.0 );
78-
t.strictEqual( isNegativeZero( v ), true, 'returns -0' );
78+
t.strictEqual( isNegativeZero( v ), true, 'returns expected value' );
7979

8080
v = max( +0.0, +0.0 );
81-
t.strictEqual( isPositiveZero( v ), true, 'returns +0' );
81+
t.strictEqual( isPositiveZero( v ), true, 'returns expected value' );
8282

8383
t.end();
8484
});
@@ -87,10 +87,10 @@ tape( 'the function returns the maximum value', function test( t ) {
8787
var v;
8888

8989
v = max( 4.2, 3.14 );
90-
t.strictEqual( v, 4.2, 'returns max value' );
90+
t.strictEqual( v, 4.2, 'returns expected value' );
9191

9292
v = max( -4.2, 3.14 );
93-
t.strictEqual( v, 3.14, 'returns max value' );
93+
t.strictEqual( v, 3.14, 'returns expected value' );
9494

9595
t.end();
9696
});

test/test.native.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ tape( 'the function may not return `NaN` if provided a `NaN`', opts, function te
5454
var v;
5555

5656
v = max( NaN, 3.14 );
57-
t.strictEqual( v, 3.14, 'returns 3.14' );
57+
t.strictEqual( v, 3.14, 'returns expected value' );
5858

5959
v = max( 3.14, NaN );
60-
t.strictEqual( isnan( v ), true, 'returns NaN' );
60+
t.strictEqual( isnan( v ), true, 'returns expected value' );
6161

6262
t.end();
6363
});
@@ -66,10 +66,10 @@ tape( 'the function returns `+infinity` if provided `+infinity`', opts, function
6666
var v;
6767

6868
v = max( PINF, 3.14 );
69-
t.strictEqual( v, PINF, 'returns +infinity' );
69+
t.strictEqual( v, PINF, 'returns expected value' );
7070

7171
v = max( 3.14, PINF );
72-
t.strictEqual( v, PINF, 'returns +infinity' );
72+
t.strictEqual( v, PINF, 'returns expected value' );
7373

7474
t.end();
7575
});
@@ -78,16 +78,16 @@ tape( 'the function may not return a correctly signed zero', opts, function test
7878
var v;
7979

8080
v = max( +0.0, -0.0 );
81-
t.strictEqual( isNegativeZero( v ), true, 'returns -0' );
81+
t.strictEqual( isNegativeZero( v ), true, 'returns expected value' );
8282

8383
v = max( -0.0, +0.0 );
84-
t.strictEqual( isNegativeZero( v ), false, 'does not return -0' );
84+
t.strictEqual( isNegativeZero( v ), false, 'returns expected value' );
8585

8686
v = max( -0.0, -0.0 );
87-
t.strictEqual( isNegativeZero( v ), true, 'returns -0' );
87+
t.strictEqual( isNegativeZero( v ), true, 'returns expected value' );
8888

8989
v = max( +0.0, +0.0 );
90-
t.strictEqual( isPositiveZero( v ), true, 'returns +0' );
90+
t.strictEqual( isPositiveZero( v ), true, 'returns expected value' );
9191

9292
t.end();
9393
});
@@ -96,10 +96,10 @@ tape( 'the function returns the maximum value', opts, function test( t ) {
9696
var v;
9797

9898
v = max( 4.2, 3.14 );
99-
t.strictEqual( v, 4.2, 'returns max value' );
99+
t.strictEqual( v, 4.2, 'returns expected value' );
100100

101101
v = max( -4.2, 3.14 );
102-
t.strictEqual( v, 3.14, 'returns max value' );
102+
t.strictEqual( v, 3.14, 'returns expected value' );
103103

104104
t.end();
105105
});

0 commit comments

Comments
 (0)