From e649599d53b6106328d916a3c02d68e7e66355af Mon Sep 17 00:00:00 2001 From: Piyush Date: Thu, 18 Dec 2025 23:19:19 +0530 Subject: [PATCH 1/2] bench: refactor to use dynamic memory allocation at number/uint8/base/mul --- 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 --- --- .../@stdlib/number/uint8/base/mul/benchmark/c/benchmark.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/number/uint8/base/mul/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/number/uint8/base/mul/benchmark/c/benchmark.c index 53f8041943d7..babc392f43f6 100644 --- a/lib/node_modules/@stdlib/number/uint8/base/mul/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/number/uint8/base/mul/benchmark/c/benchmark.c @@ -99,12 +99,13 @@ static uint8_t mul( const uint8_t x, const uint8_t y ) { * @return elapsed time in seconds */ static double benchmark( void ) { - uint8_t x[ 100 ]; + uint8_t *x; double elapsed; uint8_t y; double t; int i; + x = (uint8_t *) malloc( 100 * sizeof( uint8_t ) ); for ( i = 0; i < 100; i++ ) { x[ i ] = (uint8_t)( 2.0*rand_double() ) + 10; } @@ -121,6 +122,7 @@ static double benchmark( void ) { if ( y > 100 ) { printf( "unexpected result\n" ); } + free( x ); return elapsed; } From 90c9594f1f088dbe4967b70ed2b940ebf15bd41d Mon Sep 17 00:00:00 2001 From: Piyush Date: Thu, 18 Dec 2025 23:31:46 +0530 Subject: [PATCH 2/2] bench: refactor to use dynamic memory allocation at number/uint8/base/mul native --- 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 --- --- .../number/uint8/base/mul/benchmark/c/native/benchmark.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/number/uint8/base/mul/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/number/uint8/base/mul/benchmark/c/native/benchmark.c index 02797d544f45..48e3b39b2670 100644 --- a/lib/node_modules/@stdlib/number/uint8/base/mul/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/number/uint8/base/mul/benchmark/c/native/benchmark.c @@ -91,12 +91,13 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { - uint8_t x[ 100 ]; + uint8_t *x; double elapsed; uint8_t y; double t; int i; + x = (uint8_t *) malloc( 100 * sizeof( uint8_t ) ); for ( i = 0; i < 100; i++ ) { x[ i ] = (uint8_t)( 2.0*rand_double() ) + 10; } @@ -113,6 +114,7 @@ static double benchmark( void ) { if ( y > 100 ) { printf( "unexpected value\n" ); } + free( x ); return elapsed; }