From 649169ef90b3fbd61e827af7857a4081e80b2101 Mon Sep 17 00:00:00 2001 From: Omar Mohamed Date: Thu, 25 Dec 2025 01:16:24 +0200 Subject: [PATCH 1/2] bench: refactor to use dynamic memory allocation in strided/base/dmskmap2 --- .../base/dmskmap2/benchmark/c/benchmark.length.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/strided/base/dmskmap2/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/strided/base/dmskmap2/benchmark/c/benchmark.length.c index 7cdf28f12fd7..bb38d826a8ab 100644 --- a/lib/node_modules/@stdlib/strided/base/dmskmap2/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/strided/base/dmskmap2/benchmark/c/benchmark.length.c @@ -107,14 +107,18 @@ static double add( const double x, const double y ) { * @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 z[ len ]; + double *x; + double *y; + double *z; double t; int i; + m = (uint8_t *)malloc( len * sizeof( uint8_t ) ); + x = (double *)malloc( len * sizeof( double ) ); + y = (double *)malloc( len * sizeof( double ) ); + z = (double *)malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double()*200.0 ) - 100.0; y[ i ] = ( rand_double()*200.0 ) - 100.0; @@ -133,6 +137,10 @@ static double benchmark( int iterations, int len ) { if ( z[ i%len ] != z[ i%len ] ) { printf( "should not return NaN\n" ); } + free( m ); + free( x ); + free( y ); + free( z ); return elapsed; } From b97f96c1ce0d37f1836e4ee052be51dbfccfe3bb Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 24 Dec 2025 17:31:45 -0800 Subject: [PATCH 2/2] style: reorder variable declarations Signed-off-by: Athan --- .../strided/base/dmskmap2/benchmark/c/benchmark.length.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/strided/base/dmskmap2/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/strided/base/dmskmap2/benchmark/c/benchmark.length.c index bb38d826a8ab..e2499cd61d18 100644 --- a/lib/node_modules/@stdlib/strided/base/dmskmap2/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/strided/base/dmskmap2/benchmark/c/benchmark.length.c @@ -107,8 +107,8 @@ static double add( const double x, const double y ) { * @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 *z;