Skip to content

Commit b36cd25

Browse files
Shabareesh ShettyShabareesh Shetty
authored andcommitted
chore: update memory allocation
--- 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: passed - 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: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 22ba602 commit b36cd25

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.main.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ function createBenchmark( N ) {
8181

8282
// Reallocate the underlying memory to allow storing one vector and a complex number:
8383
nb = bytesPerElement( 'complex128' );
84-
mod.realloc( ((N*2)*nb)+nb );
84+
mod.realloc( (N*nb)+nb );
8585

8686
// Define a pointer (i.e., byte offset) to the first vector element:
8787
xptr = 0;
8888

8989
// Define a pointer to a complex number:
90-
zptr = (N*2) * nb;
90+
zptr = N * nb;
9191

9292
// Write random values to module memory:
9393
mod.write( xptr, uniform( (N*2), -100.0, 100.0, options ) );
@@ -98,8 +98,8 @@ function createBenchmark( N ) {
9898

9999
b.tic();
100100
for ( i = 0; i < b.iterations; i++ ) {
101-
mod.main( (N*2), zptr, xptr, 1 );
102-
byteOffset = xptr + ( (i%(N*2))*nb );
101+
mod.main( N, zptr, xptr, 1 );
102+
byteOffset = xptr + ( (i%N)*nb );
103103
if ( isnan( view.getFloat64( byteOffset, true ) ) ) {
104104
b.fail( 'should not return NaN' );
105105
}

lib/node_modules/@stdlib/blas/base/wasm/zscal/benchmark/benchmark.module.ndarray.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ function createBenchmark( N ) {
8181

8282
// Reallocate the underlying memory to allow storing one vector and a complex number:
8383
nb = bytesPerElement( 'complex128' );
84-
mod.realloc( ((N*2)*nb)+nb );
84+
mod.realloc( (N*nb)+nb );
8585

8686
// Define a pointer (i.e., byte offset) to the first vector element:
8787
xptr = 0;
8888

8989
// Define a pointer to a complex number:
90-
zptr = (N*2) * nb;
90+
zptr = N * nb;
9191

9292
// Write random values to module memory:
9393
mod.write( xptr, uniform( (N*2), -100.0, 100.0, options ) );
@@ -98,8 +98,8 @@ function createBenchmark( N ) {
9898

9999
b.tic();
100100
for ( i = 0; i < b.iterations; i++ ) {
101-
mod.ndarray( (N*2), zptr, xptr, 1, 0 );
102-
byteOffset = xptr + ( (i%(N*2))*nb );
101+
mod.ndarray( N, zptr, xptr, 1, 0 );
102+
byteOffset = xptr + ( (i%N)*nb );
103103
if ( isnan( view.getFloat64( byteOffset, true ) ) ) {
104104
b.fail( 'should not return NaN' );
105105
}

0 commit comments

Comments
 (0)