From f2835000c971fddc1328266b2aadf78481975b20 Mon Sep 17 00:00:00 2001 From: sujalcharati Date: Thu, 11 Dec 2025 23:43:26 +0530 Subject: [PATCH] bench: refactor to use dynamic memory allocation in blas/ext/base/cfill --- 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 --- --- .../ext/base/cfill/benchmark/c/benchmark.length.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/cfill/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/cfill/benchmark/c/benchmark.length.c index 12943c8d38a9..bd563aaae635 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/cfill/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/ext/base/cfill/benchmark/c/benchmark.length.c @@ -97,11 +97,13 @@ static float rand_float( void ) { */ static double benchmark1( int iterations, int len ) { stdlib_complex64_t alpha; - float x[ len*2 ]; + float *x; double elapsed; double t; int i; + x = (float *) malloc( len * 2 * sizeof(float) ); + alpha = stdlib_complex64( 1.0f, 0.0f ); for ( i = 0; i < len*2; i += 2 ) { x[ i ] = ( rand_float()*2.0f ) - 1.0f; @@ -120,6 +122,8 @@ static double benchmark1( int iterations, int len ) { if ( x[ 0 ] != x[ 0 ] ) { printf( "should not return NaN\n" ); } + + free( x ); return elapsed; } @@ -132,11 +136,11 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { stdlib_complex64_t alpha; - float x[ len*2 ]; + float *x; double elapsed; double t; int i; - + x = (float *) malloc( len * 2 * sizeof(float) ); alpha = stdlib_complex64( 1.0f, 0.0f ); for ( i = 0; i < len*2; i += 2 ) { x[ i ] = ( rand_float()*2.0f ) - 1.0f; @@ -155,6 +159,8 @@ static double benchmark2( int iterations, int len ) { if ( x[ 0 ] != x[ 0 ] ) { printf( "should not return NaN\n" ); } + + free( x ); return elapsed; }