bench: refactor random number generation in stats/base/dists/uniform#5027
bench: refactor random number generation in stats/base/dists/uniform#5027MunishMummadi wants to merge 1 commit into
stats/base/dists/uniform#5027Conversation
stdlib-bot
left a comment
There was a problem hiding this comment.
👋 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/uniformstats/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.
The random number generation should be moved outside the benchmarking loop, before b.tic().
There was a problem hiding this comment.
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.
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.
Thanks for the confirmation. I thought so, I will update soon.
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.
| 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.
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