-
-
Notifications
You must be signed in to change notification settings - Fork 804
bench: refactor random number generation in stats/base/dists/uniform
#5027
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 Hi there! 👋
And thank you for opening your first pull request! We will review it shortly. 🏃 💨
Coverage Report
The above coverage report was generated for the changes in this PR. |
Thanks, @MunishMummadi, for working on this! I've left a few suggestions for you to review. Also, can you change the title to: bench: refactor random number generation in |
stats/base/dists/uniform
stats/base/dists/uniform
Sure, I have updated the title. |
@anandkaranubc I don't see any code review. If that's what you mean by suggestions. Please correct me if I am wrong. |
x = uniform( -10.0, 10.0); | ||
min = uniform( -20.0, 0.0); | ||
max = min + uniform( 0.0, 40.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The random number generation should be moved outside the benchmarking loop, before b.tic()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The random number generation should be moved outside the benchmarking loop, before
b.tic()
.
I have a question about this suggestion. Are you expecting this change only for this file or to the complete PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this change is expected in the complete PR. One of the main reasons for this refactoring is to ensure that random number generation does not interfere with benchmarking. Reference PRs would be a good source to verify if your changes are correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the confirmation. I thought so, I will update soon.
lib/node_modules/@stdlib/stats/base/dists/uniform/ctor/benchmark/benchmark.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/stats/base/dists/uniform/ctor/benchmark/benchmark.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/stats/base/dists/uniform/entropy/benchmark/benchmark.js
Outdated
Show resolved
Hide resolved
Sorry, my bad. They should be visible now. |
@anandkaranubc I also added changes where they seem fit. i have doubts about the |
x = uniform( -10.0, 10.0 ); | ||
min = uniform( -20.0, 0.0 ); | ||
max = uniform( min, min + 40.0 ); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x = uniform( -10.0, 10.0 ); | |
min = uniform( -20.0, 0.0 ); | |
max = uniform( min, min + 40.0 ); | |
len = 100; | |
x = new Float64Array( len ); | |
min = new Float64Array( len ); | |
max = new Float64Array( len ); | |
for ( i = 0; i < len; i++ ) { | |
x[ i ] = uniform( -10.0, 10.0 ); | |
min[ i ] = uniform( -20.0, 0.0 ); | |
max[ i ] = uniform( min[ i ], min[ i ] + 40.0 ); | |
} | |
This would be the correct way to initialize random values for the variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this update. This really helps!!!
Meanwhile #5176 was merged, so this PR won't be needed anymore. Thanks for your efforts, @MunishMummadi, which we appreciate! |
This issue is related to #4991 i.e RFC:
Description
This PR has changes to benchmarking file located at stats/base/dists/uniform
This pull request:
rand()
with correspondinguniform()
implementation within the benchmarking files.Questions
No
Other
No.
Checklist
@stdlib-js/reviewers