From 295aca698a2dec2ddbb6698b4e876ba2997520c2 Mon Sep 17 00:00:00 2001 From: Yohan Park <88149844+yohan9569@users.noreply.github.com> Date: Mon, 22 Dec 2025 17:04:22 +0900 Subject: [PATCH 1/2] refactor: convert static to dynamic allocation in benchmark1 and benchmark2 Signed-off-by: Yohan Park <88149844+yohan9569@users.noreply.github.com> --- .../base/dsdot/benchmark/c/benchmark.length.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dsdot/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/dsdot/benchmark/c/benchmark.length.c index c19c2388a692..924d2df6163b 100644 --- a/lib/node_modules/@stdlib/blas/base/dsdot/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/dsdot/benchmark/c/benchmark.length.c @@ -96,12 +96,14 @@ static float rand_float( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - float x[ len ]; - float y[ len ]; + float *x; + float *y; double z; double t; int i; + x = (float *) malloc( len * sizeof( float ) ); + y = (float *) malloc( len * sizeof( float ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_float()*20000.0f ) - 10000.0f; y[ i ] = ( rand_float()*20000.0f ) - 10000.0f; @@ -119,6 +121,9 @@ static double benchmark1( int iterations, int len ) { if ( z != z ) { printf( "should not return NaN\n" ); } + + free( x ); + free( y ); return elapsed; } @@ -131,12 +136,14 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - float x[ len ]; - float y[ len ]; + float *x; + float *y; double z; double t; int i; + x = (float *) malloc( len * sizeof( float ) ); + y = (float *) malloc( len * sizeof( float ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_float()*20000.0f ) - 10000.0f; y[ i ] = ( rand_float()*20000.0f ) - 10000.0f; @@ -154,6 +161,8 @@ static double benchmark2( int iterations, int len ) { if ( z != z ) { printf( "should not return NaN\n" ); } + free( x ); + free( y ); return elapsed; } From 4a09e0a7a4ed4521b761a159e131995ab70372e5 Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 22 Dec 2025 02:42:22 -0800 Subject: [PATCH 2/2] style: remove empty line Signed-off-by: Athan --- .../@stdlib/blas/base/dsdot/benchmark/c/benchmark.length.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dsdot/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/dsdot/benchmark/c/benchmark.length.c index 924d2df6163b..11aa25d36a64 100644 --- a/lib/node_modules/@stdlib/blas/base/dsdot/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/dsdot/benchmark/c/benchmark.length.c @@ -121,7 +121,6 @@ static double benchmark1( int iterations, int len ) { if ( z != z ) { printf( "should not return NaN\n" ); } - free( x ); free( y ); return elapsed;