Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bench: refactor random number generation in stats/base/dists/negative-binomial #5193

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

gkbishnoi07
Copy link
Contributor

@gkbishnoi07 gkbishnoi07 commented Feb 11, 2025

Description

What is the purpose of this pull request?

This pull request:

  • Refactors random number generation in JS benchmarks for stats/base/dists/negative-binomial.
  • Replaces randu() with uniform() for cleaner and more consistent code.
  • Moves the random number generation outside the benchmarking loops to improve efficiency.

Related Issues

Does this pull request have any related issues?

This pull request:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request?

No.

Checklist

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

@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Needs Review A pull request which needs code review. labels Feb 11, 2025
@stdlib-bot
Copy link
Contributor

Hello! Thank you for your contribution to stdlib.

We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:

  1. Please read our contributing guidelines.

  2. Update your pull request description to include this checked box:

    - [x] Read, understood, and followed the [contributing guidelines](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md)

This acknowledgment confirms that you've read the guidelines, which include:

  • The developer's certificate of origin
  • Your agreement to license your contributions under the project's terms

We can't review or accept contributions without this acknowledgment.

Thank you for your understanding and cooperation. We look forward to reviewing your contribution!

@stdlib-bot
Copy link
Contributor

stdlib-bot commented Feb 11, 2025

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/negative-binomial/cdf $\color{green}272/272$
$\color{green}+100.00\%$
$\color{green}29/29$
$\color{green}+100.00\%$
$\color{green}3/3$
$\color{green}+100.00\%$
$\color{green}272/272$
$\color{green}+100.00\%$
stats/base/dists/negative-binomial/ctor $\color{green}420/420$
$\color{green}+100.00\%$
$\color{green}31/31$
$\color{green}+100.00\%$
$\color{green}16/16$
$\color{green}+100.00\%$
$\color{green}420/420$
$\color{green}+100.00\%$
stats/base/dists/negative-binomial/kurtosis $\color{green}122/122$
$\color{green}+100.00\%$
$\color{green}9/9$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}122/122$
$\color{green}+100.00\%$
stats/base/dists/negative-binomial/logpmf $\color{red}523/566$
$\color{green}+92.40\%$
$\color{red}45/51$
$\color{green}+88.24\%$
$\color{green}5/5$
$\color{green}+100.00\%$
$\color{red}523/566$
$\color{green}+92.40\%$
stats/base/dists/negative-binomial/mean $\color{green}126/126$
$\color{green}+100.00\%$
$\color{green}10/10$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}126/126$
$\color{green}+100.00\%$
stats/base/dists/negative-binomial/mgf $\color{green}235/235$
$\color{green}+100.00\%$
$\color{green}22/22$
$\color{green}+100.00\%$
$\color{green}3/3$
$\color{green}+100.00\%$
$\color{green}235/235$
$\color{green}+100.00\%$
stats/base/dists/negative-binomial/mode $\color{green}123/123$
$\color{green}+100.00\%$
$\color{green}9/9$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}123/123$
$\color{green}+100.00\%$
stats/base/dists/negative-binomial/pmf $\color{red}532/562$
$\color{green}+94.66\%$
$\color{red}49/57$
$\color{green}+85.96\%$
$\color{green}5/5$
$\color{green}+100.00\%$
$\color{red}532/562$
$\color{green}+94.66\%$
stats/base/dists/negative-binomial/quantile $\color{green}402/402$
$\color{green}+100.00\%$
$\color{green}52/52$
$\color{green}+100.00\%$
$\color{green}5/5$
$\color{green}+100.00\%$
$\color{green}402/402$
$\color{green}+100.00\%$
stats/base/dists/negative-binomial/skewness $\color{green}123/123$
$\color{green}+100.00\%$
$\color{green}9/9$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}123/123$
$\color{green}+100.00\%$
stats/base/dists/negative-binomial/stdev $\color{green}123/123$
$\color{green}+100.00\%$
$\color{green}9/9$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}123/123$
$\color{green}+100.00\%$
stats/base/dists/negative-binomial/variance $\color{green}122/122$
$\color{green}+100.00\%$
$\color{green}9/9$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}122/122$
$\color{green}+100.00\%$

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

@gkbishnoi07 gkbishnoi07 reopened this Feb 11, 2025
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Feb 11, 2025
@stdlib-bot
Copy link
Contributor

Hello! Thank you for your contribution to stdlib.

We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:

  1. Please read our contributing guidelines.

  2. Update your pull request description to include this checked box:

    - [x] Read, understood, and followed the [contributing guidelines](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md)

This acknowledgment confirms that you've read the guidelines, which include:

  • The developer's certificate of origin
  • Your agreement to license your contributions under the project's terms

We can't review or accept contributions without this acknowledgment.

Thank you for your understanding and cooperation. We look forward to reviewing your contribution!

@gkbishnoi07
Copy link
Contributor Author

@anandkaranubc ready for review

@anandkaranubc
Copy link
Contributor

@anandkaranubc ready for review

@gkbishnoi07, I left some comments for you to review. Please ensure that the suggested changes are applied consistently throughout the PR, including areas where they were not explicitly mentioned but are necessary.

@stdlib-bot stdlib-bot removed the First-time Contributor A pull request from a contributor who has never previously committed to the project repository. label Feb 11, 2025
@gkbishnoi07 gkbishnoi07 changed the title bench: Refactor random number generation in stats/base/dists/negative-binomial bench: refactor random number generation in stats/base/dists/negative-binomial Feb 12, 2025
@gkbishnoi07
Copy link
Contributor Author

@anandkaranubc please review

@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review A pull request which needs code review. 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/negative-binomial
3 participants