-
-
Notifications
You must be signed in to change notification settings - Fork 687
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
[RFC]: Refactor random number generation in JS benchmarks for stats/base/dists/truncated-normal
#4990
Comments
Hi @anandkaranubc , I am unable to find the cdf/benchmark/benchmark.js directory for truncated-normal folder. Can you please point it out, so I can work on this issue? |
That's correct. It hasn't been implemented yet. |
hello @anandkaranubc i wanted to ask that can i work on the implementation of its inner functions so for that will i have to create another issue or i can do in this only so basically for the implementation of that we have to write total 9 files with the benchmarks, examples , src and lib cdf (Cumulative Distribution Function) - shown above |
Hi @Krishna-Sharma-g, are you referring to this current issue or the issues related to the C implementations? This issue only involves refactoring random number generation in JavaScript benchmarks and is not related to any C code. |
no @anandkaranubc i have to implement this so for that do i have to create another issue for that |
If you want to create a PR targeting this issue, feel free to proceed. Just make sure to review the reference PRs first. |
is anyone done it ? |
Closing this issue as it does not apply to |
Description
This RFC proposes improving random number generation in JS benchmarks for
stats/base/dists/truncated-normal
.Context: At present, in the remaining packages, random number generation in JS benchmarks occurs inside the benchmarking loop. Since random number generation is an expensive operation, it should be moved out of the benchmarking loops and initialized beforehand to avoid interfering with the results.
When adding support, the following tasks should be completed:
Move random number generation out of the benchmarking loops and initialize it before the benchmarks.
Ensure that the generated random values use the same range as the existing values to maintain consistency.
Use
uniform
anddiscreteUniform
from@stdlib/random/base/uniform
and@stdlib/random/base/discrete-uniform
instead ofrandu
expressions.( randu() * 10.0 + EPS )
withuniform( EPS, 10.0 )
.ceil( randu() * 10.0 + EPS )
withdiscreteUniform( 1, 10 )
.To provide a concrete example of what a PR implementing the desired changes should contain, see #4837 and #4955, which provide examples for using both
uniform
anddiscreteUniform
.Related Issues
#4837, #4955
Questions
No.
Other
Once the implementation is complete, you should be able to run the following
make
commands:Build Native Add-on
NODE_ADDONS_PATTERN="@stdlib/stats/base/dists/truncated-normal/*" make install-node-addons
Run JavaScript Benchmarks
make benchmark-javascript-files FILES="$(pwd)/lib/node_modules/@stdlib/stats/base/dists/truncated-normal/*/benchmark/benchmark.js"
Run JavaScript Native Benchmarks
make benchmark-javascript-files FILES="$(pwd)/lib/node_modules/@stdlib/stats/base/dists/truncated-normal/*/benchmark/benchmark.native.js"
Note: If running benchmarks results in an error, it is likely due to the random number generators producing values where the functions are not defined. To resolve this, check the relevant benchmark files, adjust the input value ranges to ensure they remain within the domain where the functions are valid, and then rerun the benchmarks. Reference: #4955
Checklist
RFC:
.The text was updated successfully, but these errors were encountered: