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

Merged
merged 8 commits into from
Feb 16, 2025

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

Copy link
Contributor

@anandkaranubc anandkaranubc left a comment

Choose a reason for hiding this comment

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

Some minor changes. Rest looks good. Great work!

@anandkaranubc anandkaranubc added the Needs Changes Pull request which needs changes before being merged. label Feb 12, 2025
@gkbishnoi07
Copy link
Contributor Author

Some minor changes. Rest looks good. Great work!

Got it! I'll make the necessary changes. Thanks for the feedback!

@gkbishnoi07
Copy link
Contributor Author

@anandkaranubc All changes have been applied and are ready for review.

@gkbishnoi07
Copy link
Contributor Author

@anandkaranubc please review

@gkbishnoi07
Copy link
Contributor Author

@anandkaranubc any updates

@gkbishnoi07
Copy link
Contributor Author

@kgryte @hrshya can you please review this PRs

@anandkaranubc
Copy link
Contributor

@anandkaranubc please review

On it!

Copy link
Contributor

@anandkaranubc anandkaranubc left a comment

Choose a reason for hiding this comment

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

After this change, the PR should be ready to merge.

@anandkaranubc anandkaranubc removed the Needs Review A pull request which needs code review. label Feb 16, 2025
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Feb 16, 2025
@gkbishnoi07
Copy link
Contributor Author

@anandkaranubc ready for review

@anandkaranubc
Copy link
Contributor

@anandkaranubc ready for review

Looks good! Thanks for working on this issue. You can wait for a maintainer to merge this PR. In the meantime, please update your title to:

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

Just add the `` around stats/base/dists/negative-binomial

@anandkaranubc anandkaranubc added Ready To Merge A pull request which is ready to be merged. and removed Needs Review A pull request which needs code review. Needs Changes Pull request which needs changes before being merged. labels Feb 16, 2025
@anandkaranubc
Copy link
Contributor

/stdlib merge

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Feb 16, 2025
@stdlib-bot
Copy link
Contributor

PR Commit Message

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

PR-URL: https://github.com/stdlib-js/stdlib/pull/5193
Closes: https://github.com/stdlib-js/stdlib/issues/4980

Co-authored-by: Gopi Kishan <gkishan1kyt@gmail.com>

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

@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Feb 16, 2025
@gkbishnoi07
Copy link
Contributor Author

@anandkaranubc ready for review

Looks good! Thanks for working on this issue. You can wait for a maintainer to merge this PR. In the meantime, please update your title to:

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

Just add the `` around stats/base/dists/negative-binomial

The title is same bench: refactor random number generation in stats/base/dists/negative-binomial??

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.

Thanks @gkbishnoi07 for your PR and @anandkaranubc for review!

@Planeshifter Planeshifter 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 16, 2025
@Planeshifter
Copy link
Member

@gkbishnoi07

@anandkaranubc ready for review

Looks good! Thanks for working on this issue. You can wait for a maintainer to merge this PR. In the meantime, please update your title to:
bench: refactor random number generation in stats/base/dists/negative-binomial
Just add the `` around stats/base/dists/negative-binomial

The title is same bench: refactor random number generation in stats/base/dists/negative-binomial??

Karan was referring to including backticks around the package path. That's just a convention we have; otherwise PR title was fine.

@Planeshifter Planeshifter merged commit 39f6970 into stdlib-js:develop Feb 16, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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/negative-binomial
4 participants