Skip to content

Commit 01768f7

Browse files
committed
bench: add "generic" dtype benchmark
--- 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 260d472 commit 01768f7

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

  • lib/node_modules/@stdlib/ndarray/base/falses/benchmark

lib/node_modules/@stdlib/ndarray/base/falses/benchmark/benchmark.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,21 @@ bench( format( '%s:dtype=bool', pkg ), function benchmark( b ) {
4646
b.pass( 'benchmark finished' );
4747
b.end();
4848
});
49+
50+
bench( format( '%s:dtype=generic', pkg ), function benchmark( b ) {
51+
var arr;
52+
var i;
53+
b.tic();
54+
for ( i = 0; i < b.iterations; i++ ) {
55+
arr = falses( 'generic', [ 0 ], 'row-major' );
56+
if ( arr.length !== 0 ) {
57+
b.fail( 'should have length 0' );
58+
}
59+
}
60+
b.toc();
61+
if ( !isndarrayLike( arr ) ) {
62+
b.fail( 'should return an ndarray' );
63+
}
64+
b.pass( 'benchmark finished' );
65+
b.end();
66+
});

0 commit comments

Comments
 (0)