From 149cc7547028c963dd8600ce83c434dfc66af369 Mon Sep 17 00:00:00 2001 From: Omar Mohamed Date: Thu, 25 Dec 2025 01:24:01 +0200 Subject: [PATCH 1/2] bench: refactor to use dynamic memory allocation in strided/base/dmskmap --- .../base/dmskmap/benchmark/c/benchmark.length.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/strided/base/dmskmap/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/strided/base/dmskmap/benchmark/c/benchmark.length.c index e4950d55d41f..5edbc060ae77 100644 --- a/lib/node_modules/@stdlib/strided/base/dmskmap/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/strided/base/dmskmap/benchmark/c/benchmark.length.c @@ -106,13 +106,16 @@ static double identity( const double x ) { * @return elapsed time in seconds */ static double benchmark( int iterations, int len ) { - uint8_t m[ len ]; + uint8_t *m; double elapsed; - double x[ len ]; - double y[ len ]; + double *x; + double *y; double t; int i; + m = (uint8_t *)malloc( len * sizeof( uint8_t ) ); + x = (double *)malloc( len * sizeof( double ) ); + y = (double *)malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double()*200.0 ) - 100.0; m[ i ] = i % 2; @@ -130,6 +133,9 @@ static double benchmark( int iterations, int len ) { if ( y[ i%len ] != y[ i%len ] ) { printf( "should not return NaN\n" ); } + free( m ); + free( x ); + free( y ); return elapsed; } From cd3850db8f7bad403f644a654639fcfe781be288 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 24 Dec 2025 17:30:44 -0800 Subject: [PATCH 2/2] style: reorder variable declarations Signed-off-by: Athan --- .../@stdlib/strided/base/dmskmap/benchmark/c/benchmark.length.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/strided/base/dmskmap/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/strided/base/dmskmap/benchmark/c/benchmark.length.c index 5edbc060ae77..270e3fc29ccf 100644 --- a/lib/node_modules/@stdlib/strided/base/dmskmap/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/strided/base/dmskmap/benchmark/c/benchmark.length.c @@ -106,8 +106,8 @@ static double identity( const double x ) { * @return elapsed time in seconds */ static double benchmark( int iterations, int len ) { - uint8_t *m; double elapsed; + uint8_t *m; double *x; double *y; double t;