From b61c7b73c6e90864b35146fdea95c18d0a34e85d Mon Sep 17 00:00:00 2001 From: Vishal Gaikwad Date: Mon, 5 Jan 2026 15:26:13 +0530 Subject: [PATCH 1/6] bench: refactor to use string interpolation in buffer/from-array-buffer --- 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 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 --- --- .../buffer/from-arraybuffer/benchmark/benchmark.length.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/buffer/from-arraybuffer/benchmark/benchmark.length.js b/lib/node_modules/@stdlib/buffer/from-arraybuffer/benchmark/benchmark.length.js index ca9820cc557c..dec1bff341ee 100644 --- a/lib/node_modules/@stdlib/buffer/from-arraybuffer/benchmark/benchmark.length.js +++ b/lib/node_modules/@stdlib/buffer/from-arraybuffer/benchmark/benchmark.length.js @@ -25,6 +25,7 @@ var pow = require( '@stdlib/math/base/special/pow' ); var isBuffer = require( '@stdlib/assert/is-buffer' ); var ArrayBuffer = require( '@stdlib/array/buffer' ); var Uint8Array = require( '@stdlib/array/uint8' ); +var format = require( '@stdlib/string/format' ); var pkg = require( './../package.json' ).name; var arraybuffer2buffer = require( './../lib' ); @@ -95,7 +96,7 @@ function main() { for ( i = min; i <= max; i++ ) { len = pow( 10, i ); f = createBenchmark( len ); - bench( pkg+':len='+len, f ); + bench( format( '%s:len=%d', pkg, len ), f ); } } From 55941298fd5440723ac0d0695612d07217ff01b8 Mon Sep 17 00:00:00 2001 From: Vishal Gaikwad Date: Fri, 9 Jan 2026 20:04:58 +0530 Subject: [PATCH 2/6] bench: refactor to use dynamic memory allocation in stats/strided/dminsorted --- 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 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: na - 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: missing_dependencies - 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 --- --- .../strided/dminsorted/benchmark/c/benchmark.length.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/strided/dminsorted/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dminsorted/benchmark/c/benchmark.length.c index 2a1baaf2d489..4e7618c49a63 100644 --- a/lib/node_modules/@stdlib/stats/strided/dminsorted/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dminsorted/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = i; } @@ -118,6 +119,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -130,11 +132,12 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = i; } @@ -152,6 +155,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } From f9c1c03a323f3b749488b3beb25a656e20e1631e Mon Sep 17 00:00:00 2001 From: Vishal Gaikwad Date: Fri, 9 Jan 2026 20:12:58 +0530 Subject: [PATCH 3/6] bench: refactor to use dynamic memory allocation in stats/strided/dmskmax --- 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 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: na - 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: missing_dependencies - 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 --- --- .../stats/strided/dmskmax/benchmark/c/benchmark.length.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/strided/dmskmax/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dmskmax/benchmark/c/benchmark.length.c index eb429c94db8b..7c2815ec0c16 100644 --- a/lib/node_modules/@stdlib/stats/strided/dmskmax/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dmskmax/benchmark/c/benchmark.length.c @@ -97,11 +97,12 @@ static double rand_double( void ) { static double benchmark1( int iterations, int len ) { unsigned char mask[ len ]; double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { mask[ i ] = 1; // missing @@ -124,6 +125,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -137,11 +139,12 @@ static double benchmark1( int iterations, int len ) { static double benchmark2( int iterations, int len ) { unsigned char mask[ len ]; double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { mask[ i ] = 1; // missing @@ -164,6 +167,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } From ae855c80d8cf65276c4ca1a8987e5312380be0e4 Mon Sep 17 00:00:00 2001 From: Vishal Gaikwad Date: Fri, 9 Jan 2026 21:43:59 +0530 Subject: [PATCH 4/6] bench: refactor to use dynamic memory allocation in stats/strided/dmskmin --- 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 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: na - 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: missing_dependencies - 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 --- --- .../stats/strided/dmskmin/benchmark/c/benchmark.length.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/strided/dmskmin/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dmskmin/benchmark/c/benchmark.length.c index c60b2076ee7f..db42e4e7522a 100644 --- a/lib/node_modules/@stdlib/stats/strided/dmskmin/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dmskmin/benchmark/c/benchmark.length.c @@ -97,11 +97,12 @@ static double rand_double( void ) { static double benchmark1( int iterations, int len ) { unsigned char mask[ len ]; double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { mask[ i ] = 1; // missing @@ -124,6 +125,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -137,11 +139,12 @@ static double benchmark1( int iterations, int len ) { static double benchmark2( int iterations, int len ) { unsigned char mask[ len ]; double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { mask[ i ] = 1; // missing @@ -164,6 +167,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } From 4f2fd31d5179133e474065953f2a663f132862bf Mon Sep 17 00:00:00 2001 From: Vishal Gaikwad <154438441+ivishal-g@users.noreply.github.com> Date: Fri, 9 Jan 2026 08:20:12 -0800 Subject: [PATCH 5/6] Delete lib/node_modules/@stdlib/stats/strided/dminsorted/benchmark/c/benchmark.length.c Signed-off-by: Vishal Gaikwad <154438441+ivishal-g@users.noreply.github.com> --- .../dminsorted/benchmark/c/benchmark.length.c | 201 ------------------ 1 file changed, 201 deletions(-) delete mode 100644 lib/node_modules/@stdlib/stats/strided/dminsorted/benchmark/c/benchmark.length.c diff --git a/lib/node_modules/@stdlib/stats/strided/dminsorted/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dminsorted/benchmark/c/benchmark.length.c deleted file mode 100644 index 4e7618c49a63..000000000000 --- a/lib/node_modules/@stdlib/stats/strided/dminsorted/benchmark/c/benchmark.length.c +++ /dev/null @@ -1,201 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/stats/strided/dminsorted.h" -#include -#include -#include -#include -#include - -#define NAME "dminsorted" -#define ITERATIONS 1000000 -#define REPEATS 3 -#define MIN 1 -#define MAX 6 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param iterations number of iterations -* @param elapsed elapsed time in seconds -*/ -static void print_results( int iterations, double elapsed ) { - double rate = (double)iterations / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", iterations ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @param iterations number of iterations -* @param len array length -* @return elapsed time in seconds -*/ -static double benchmark1( int iterations, int len ) { - double elapsed; - double *x; - double v; - double t; - int i; - - x = (double *) malloc( len * sizeof( double ) ); - for ( i = 0; i < len; i++ ) { - x[ i ] = i; - } - v = 0.0; - t = tic(); - for ( i = 0; i < iterations; i++ ) { - // cppcheck-suppress uninitvar - v = stdlib_strided_dminsorted( len, x, 1 ); - if ( v != v ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( v != v ) { - printf( "should not return NaN\n" ); - } - free( x ); - return elapsed; -} - -/** -* Runs a benchmark. -* -* @param iterations number of iterations -* @param len array length -* @return elapsed time in seconds -*/ -static double benchmark2( int iterations, int len ) { - double elapsed; - double *x; - double v; - double t; - int i; - - x = (double *) malloc( len * sizeof( double ) ); - for ( i = 0; i < len; i++ ) { - x[ i ] = i; - } - v = 0.0; - t = tic(); - for ( i = 0; i < iterations; i++ ) { - // cppcheck-suppress uninitvar - v = stdlib_strided_dminsorted_ndarray( len, x, 1, 0 ); - if ( v != v ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( v != v ) { - printf( "should not return NaN\n" ); - } - free( x ); - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int count; - int iter; - int len; - int i; - int j; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - count = 0; - for ( i = MIN; i <= MAX; i++ ) { - len = pow( 10, i ); - iter = ITERATIONS; - for ( j = 0; j < REPEATS; j++ ) { - count += 1; - printf( "# c::%s:len=%d\n", NAME, len ); - elapsed = benchmark1( iter, len ); - print_results( iter, elapsed ); - printf( "ok %d benchmark finished\n", count ); - } - } - for ( i = MIN; i <= MAX; i++ ) { - len = pow( 10, i ); - iter = ITERATIONS / pow( 10, i-1 ); - for ( j = 0; j < REPEATS; j++ ) { - count += 1; - printf( "# c::%s:ndarray:len=%d\n", NAME, len ); - elapsed = benchmark2( iter, len ); - print_results( iter, elapsed ); - printf( "ok %d benchmark finished\n", count ); - } - } - print_summary( count, count ); -} From b6efc85a299005215c13494dc82303d0a4adf773 Mon Sep 17 00:00:00 2001 From: Vishal Gaikwad <154438441+ivishal-g@users.noreply.github.com> Date: Fri, 9 Jan 2026 08:22:55 -0800 Subject: [PATCH 6/6] Delete lib/node_modules/@stdlib/stats/strided/dmskmax/benchmark/c/benchmark.length.c Signed-off-by: Vishal Gaikwad <154438441+ivishal-g@users.noreply.github.com> --- .../dmskmax/benchmark/c/benchmark.length.c | 213 ------------------ 1 file changed, 213 deletions(-) delete mode 100644 lib/node_modules/@stdlib/stats/strided/dmskmax/benchmark/c/benchmark.length.c diff --git a/lib/node_modules/@stdlib/stats/strided/dmskmax/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dmskmax/benchmark/c/benchmark.length.c deleted file mode 100644 index 7c2815ec0c16..000000000000 --- a/lib/node_modules/@stdlib/stats/strided/dmskmax/benchmark/c/benchmark.length.c +++ /dev/null @@ -1,213 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/stats/strided/dmskmax.h" -#include -#include -#include -#include -#include - -#define NAME "dmskmax" -#define ITERATIONS 1000000 -#define REPEATS 3 -#define MIN 1 -#define MAX 6 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param iterations number of iterations -* @param elapsed elapsed time in seconds -*/ -static void print_results( int iterations, double elapsed ) { - double rate = (double)iterations / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", iterations ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @param iterations number of iterations -* @param len array length -* @return elapsed time in seconds -*/ -static double benchmark1( int iterations, int len ) { - unsigned char mask[ len ]; - double elapsed; - double *x; - double v; - double t; - int i; - - x = (double *) malloc( len * sizeof( double ) ); - for ( i = 0; i < len; i++ ) { - if ( rand_double() < 0.2 ) { - mask[ i ] = 1; // missing - } else { - mask[ i ] = 0; - } - x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; - } - v = 0.0; - t = tic(); - for ( i = 0; i < iterations; i++ ) { - // cppcheck-suppress uninitvar - v = stdlib_strided_dmskmax( len, x, 1, mask, 1 ); - if ( v != v ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( v != v ) { - printf( "should not return NaN\n" ); - } - free( x ); - return elapsed; -} - -/** -* Runs a benchmark. -* -* @param iterations number of iterations -* @param len array length -* @return elapsed time in seconds -*/ -static double benchmark2( int iterations, int len ) { - unsigned char mask[ len ]; - double elapsed; - double *x; - double v; - double t; - int i; - - x = (double *) malloc( len * sizeof( double ) ); - for ( i = 0; i < len; i++ ) { - if ( rand_double() < 0.2 ) { - mask[ i ] = 1; // missing - } else { - mask[ i ] = 0; - } - x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; - } - v = 0.0; - t = tic(); - for ( i = 0; i < iterations; i++ ) { - // cppcheck-suppress uninitvar - v = stdlib_strided_dmskmax_ndarray( len, x, 1, 0, mask, 1, 0 ); - if ( v != v ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( v != v ) { - printf( "should not return NaN\n" ); - } - free( x ); - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int count; - int iter; - int len; - int i; - int j; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - count = 0; - for ( i = MIN; i <= MAX; i++ ) { - len = pow( 10, i ); - iter = ITERATIONS / pow( 10, i-1 ); - for ( j = 0; j < REPEATS; j++ ) { - count += 1; - printf( "# c::%s:len=%d\n", NAME, len ); - elapsed = benchmark1( iter, len ); - print_results( iter, elapsed ); - printf( "ok %d benchmark finished\n", count ); - } - } - for ( i = MIN; i <= MAX; i++ ) { - len = pow( 10, i ); - iter = ITERATIONS / pow( 10, i-1 ); - for ( j = 0; j < REPEATS; j++ ) { - count += 1; - printf( "# c::%s:ndarray:len=%d\n", NAME, len ); - elapsed = benchmark2( iter, len ); - print_results( iter, elapsed ); - printf( "ok %d benchmark finished\n", count ); - } - } - print_summary( count, count ); -}