Skip to content

Commit a4813ba

Browse files
committed
bench: add factory benchmarks
--- 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 --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: passed - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent e53463c commit a4813ba

File tree

1 file changed

+24
-0
lines changed
  • lib/node_modules/@stdlib/stats/base/dists/bradford/pdf/benchmark

1 file changed

+24
-0
lines changed

lib/node_modules/@stdlib/stats/base/dists/bradford/pdf/benchmark/benchmark.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,27 @@ bench( pkg, function benchmark( b ) {
5252
b.pass( 'benchmark finished' );
5353
b.end();
5454
});
55+
56+
bench( pkg+':factory', function benchmark( b ) {
57+
var mypdf;
58+
var x;
59+
var y;
60+
var i;
61+
62+
x = uniform( 100, 0.0, 1.0 );
63+
mypdf = pdf.factory( 5.0 );
64+
65+
b.tic();
66+
for ( i = 0; i < b.iterations; i++ ) {
67+
y = mypdf( x[ i % x.length ] );
68+
if ( isnan( y ) ) {
69+
b.fail( 'should not return NaN' );
70+
}
71+
}
72+
b.toc();
73+
if ( isnan( y ) ) {
74+
b.fail( 'should not return NaN' );
75+
}
76+
b.pass( 'benchmark finished' );
77+
b.end();
78+
});

0 commit comments

Comments
 (0)