Skip to content

Commit 874d1e6

Browse files
committed
chore: update bench
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 0ff8764 commit 874d1e6

2 files changed

Lines changed: 28 additions & 30 deletions

File tree

lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2025 The Stdlib Authors.
4+
* Copyright (c) 2026 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@ var uniform = require( '@stdlib/random/array/uniform' );
2525
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' );
28+
var format = require( '@stdlib/string/format' );
2829
var pkg = require( './../package.json' ).name;
2930
var dzasum = require( './../lib/dzasum.js' );
3031

@@ -39,16 +40,14 @@ var options = {
3940
// FUNCTIONS //
4041

4142
/**
42-
* Creates a benchmark function.
43+
* Create a benchmark function.
4344
*
4445
* @private
45-
* @param {PositiveInteger} N - array length
46+
* @param {PositiveInteger} len - array length
4647
* @returns {Function} benchmark function
4748
*/
48-
function createBenchmark( N ) {
49-
var x;
50-
51-
x = new Complex128Array( uniform( N*2, -100.0, 100.0, options ) );
49+
function createBenchmark( len ) {
50+
var x = new Complex128Array( uniform( len*2, -10.0, 10.0, options ) );
5251
return benchmark;
5352

5453
/**
@@ -58,18 +57,18 @@ function createBenchmark( N ) {
5857
* @param {Benchmark} b - benchmark instance
5958
*/
6059
function benchmark( b ) {
61-
var y;
60+
var out;
6261
var i;
6362

6463
b.tic();
6564
for ( i = 0; i < b.iterations; i++ ) {
66-
y = dzasum( x.length, x, 1 );
67-
if ( isnan( y ) ) {
65+
out = dzasum( x.length, x, 1 );
66+
if ( isnan( out ) ) {
6867
b.fail( 'should not return NaN' );
6968
}
7069
}
7170
b.toc();
72-
if ( isnan( y ) ) {
71+
if ( isnan( out ) ) {
7372
b.fail( 'should not return NaN' );
7473
}
7574
b.pass( 'benchmark finished' );
@@ -86,19 +85,19 @@ function createBenchmark( N ) {
8685
* @private
8786
*/
8887
function main() {
88+
var len;
8989
var min;
9090
var max;
91-
var N;
9291
var f;
9392
var i;
9493

9594
min = 1; // 10^min
9695
max = 6; // 10^max
9796

9897
for ( i = min; i <= max; i++ ) {
99-
N = pow( 10, i );
100-
f = createBenchmark( N );
101-
bench( pkg+':size='+N, f );
98+
len = pow( 10, i );
99+
f = createBenchmark( len );
100+
bench( format( '%s:len=%d', pkg, len ), f );
102101
}
103102
}
104103

lib/node_modules/@stdlib/blas/base/dzasum/benchmark/benchmark.ndarray.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2025 The Stdlib Authors.
4+
* Copyright (c) 2026 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@ var uniform = require( '@stdlib/random/array/uniform' );
2525
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' );
28+
var format = require( '@stdlib/string/format' );
2829
var pkg = require( './../package.json' ).name;
2930
var dzasum = require( './../lib/ndarray.js' );
3031

@@ -39,16 +40,14 @@ var options = {
3940
// FUNCTIONS //
4041

4142
/**
42-
* Creates a benchmark function.
43+
* Create a benchmark function.
4344
*
4445
* @private
45-
* @param {PositiveInteger} N - array length
46+
* @param {PositiveInteger} len - array length
4647
* @returns {Function} benchmark function
4748
*/
48-
function createBenchmark( N ) {
49-
var x;
50-
51-
x = new Complex128Array( uniform( N*2, -100.0, 100.0, options ) );
49+
function createBenchmark( len ) {
50+
var x = new Complex128Array( uniform( len*2, -10.0, 10.0, options ) );
5251
return benchmark;
5352

5453
/**
@@ -58,18 +57,18 @@ function createBenchmark( N ) {
5857
* @param {Benchmark} b - benchmark instance
5958
*/
6059
function benchmark( b ) {
61-
var y;
60+
var out;
6261
var i;
6362

6463
b.tic();
6564
for ( i = 0; i < b.iterations; i++ ) {
66-
y = dzasum( x.length, x, 1, 0 );
67-
if ( isnan( y ) ) {
65+
out = dzasum( x.length, x, 1, 0 );
66+
if ( isnan( out ) ) {
6867
b.fail( 'should not return NaN' );
6968
}
7069
}
7170
b.toc();
72-
if ( isnan( y ) ) {
71+
if ( isnan( out ) ) {
7372
b.fail( 'should not return NaN' );
7473
}
7574
b.pass( 'benchmark finished' );
@@ -86,19 +85,19 @@ function createBenchmark( N ) {
8685
* @private
8786
*/
8887
function main() {
88+
var len;
8989
var min;
9090
var max;
91-
var N;
9291
var f;
9392
var i;
9493

9594
min = 1; // 10^min
9695
max = 6; // 10^max
9796

9897
for ( i = min; i <= max; i++ ) {
99-
N = pow( 10, i );
100-
f = createBenchmark( N );
101-
bench( pkg+':ndarray:size='+N, f );
98+
len = pow( 10, i );
99+
f = createBenchmark( len );
100+
bench( format( '%s:ndarray:len=%d', pkg, len ), f );
102101
}
103102
}
104103

0 commit comments

Comments
 (0)