Skip to content

Conversation

G4URAV001
Copy link
Contributor

… JS benchmarks

Resolves #4992 .

Description

This pull request:

This pull request improves random number generation in JS benchmarks for stats/base/dists/weibull. Specifically:

Moves random number generation out of benchmarking loops to prevent interference with benchmark results.

Uses @stdlib/random/base/uniform and @stdlib/random/base/discrete-uniform instead of randu expressions.

Ensures generated random values maintain the same range as existing values for consistency.

Related Issues

Does this pull request have any related issues?

References #4837 and #4955 as examples of similar improvements.

This pull request:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

✅ Build Native Add-on.
✅ Run JavaScript Benchmarks.
✅ Run JavaScript Native Benchmarks.


@stdlib-js/reviewers

… JS 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: na
  - task: run_julia_benchmarks
    status: na
  - task: run_python_benchmarks
    status: na
  - task: run_r_benchmarks
    status: na
  - task: run_javascript_tests
    status: na
---
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Needs Review A pull request which needs code review. labels Feb 20, 2025
@stdlib-bot
Copy link
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/weibull/cdf $\color{green}298/298$
$\color{green}+100.00\%$
$\color{green}25/25$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}298/298$
$\color{green}+100.00\%$
stats/base/dists/weibull/ctor $\color{red}486/487$
$\color{green}+99.79\%$
$\color{green}33/33$
$\color{green}+100.00\%$
$\color{red}18/19$
$\color{green}+94.74\%$
$\color{red}486/487$
$\color{green}+99.79\%$
stats/base/dists/weibull/entropy $\color{green}126/126$
$\color{green}+100.00\%$
$\color{green}8/8$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}126/126$
$\color{green}+100.00\%$
stats/base/dists/weibull/kurtosis $\color{green}137/137$
$\color{green}+100.00\%$
$\color{green}8/8$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}137/137$
$\color{green}+100.00\%$
stats/base/dists/weibull/logcdf $\color{green}311/311$
$\color{green}+100.00\%$
$\color{green}28/28$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}311/311$
$\color{green}+100.00\%$
stats/base/dists/weibull/logpdf $\color{green}308/308$
$\color{green}+100.00\%$
$\color{green}35/35$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}308/308$
$\color{green}+100.00\%$
stats/base/dists/weibull/mean $\color{green}195/195$
$\color{green}+100.00\%$
$\color{green}10/10$
$\color{green}+100.00\%$
$\color{green}2/2$
$\color{green}+100.00\%$
$\color{green}195/195$
$\color{green}+100.00\%$
stats/base/dists/weibull/median $\color{green}197/197$
$\color{green}+100.00\%$
$\color{green}10/10$
$\color{green}+100.00\%$
$\color{green}2/2$
$\color{green}+100.00\%$
$\color{green}197/197$
$\color{green}+100.00\%$
stats/base/dists/weibull/mgf $\color{red}262/264$
$\color{green}+99.24\%$
$\color{red}23/25$
$\color{green}+92.00\%$
$\color{green}3/3$
$\color{green}+100.00\%$
$\color{red}262/264$
$\color{green}+99.24\%$
stats/base/dists/weibull/mode $\color{green}128/128$
$\color{green}+100.00\%$
$\color{green}10/10$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}128/128$
$\color{green}+100.00\%$
stats/base/dists/weibull/pdf $\color{green}310/310$
$\color{green}+100.00\%$
$\color{green}36/36$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}310/310$
$\color{green}+100.00\%$
stats/base/dists/weibull/quantile $\color{green}218/218$
$\color{green}+100.00\%$
$\color{green}23/23$
$\color{green}+100.00\%$
$\color{green}3/3$
$\color{green}+100.00\%$
$\color{green}218/218$
$\color{green}+100.00\%$
stats/base/dists/weibull/skewness $\color{green}139/139$
$\color{green}+100.00\%$
$\color{green}8/8$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}139/139$
$\color{green}+100.00\%$
stats/base/dists/weibull/stdev $\color{green}128/128$
$\color{green}+100.00\%$
$\color{green}8/8$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}128/128$
$\color{green}+100.00\%$
stats/base/dists/weibull/variance $\color{green}128/128$
$\color{green}+100.00\%$
$\color{green}8/8$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}128/128$
$\color{green}+100.00\%$

The above coverage report was generated for the changes in this PR.

@G4URAV001
Copy link
Contributor Author

@anandkaranubc please review this PR

Copy link
Member

@Planeshifter Planeshifter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks much, @G4URAV001!

@Planeshifter Planeshifter added the Ready To Merge A pull request which is ready to be merged. label Mar 5, 2025
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Mar 5, 2025
@stdlib-bot
Copy link
Contributor

PR Commit Message

bench: refactor random number generation in `stats/base/dists/weibull`

PR-URL: https://github.com/stdlib-js/stdlib/pull/5342
Closes: https://github.com/stdlib-js/stdlib/issues/4992

Co-authored-by: G4URAV001 <[email protected]>
Reviewed-by: Philipp Burckhardt <[email protected]>

Please review the above commit message and make any necessary adjustments.

@Planeshifter Planeshifter merged commit 1ebcfd6 into stdlib-js:develop Mar 5, 2025
58 checks passed
@stdlib-bot stdlib-bot added the Good First PR A pull request resolving a Good First Issue. label Mar 5, 2025
@G4URAV001 G4URAV001 deleted the G4URAV001-issue-4992 branch March 5, 2025 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First PR A pull request resolving a Good First Issue. Ready To Merge A pull request which is ready to be merged. Statistics Issue or pull request related to statistical functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC]: Refactor random number generation in JS benchmarks for stats/base/dists/weibull
3 participants