Skip to content

Conversation

@hrshya
Copy link
Contributor

@hrshya hrshya commented Jan 27, 2026

Resolves none .

Description

What is the purpose of this pull request?

This pull request:

  • Refactors random number generation in JS benchmarks for the stats/base/dists/t/* packages.
  • Replaces uniform() from @stdlib/random/array/uniform for cleaner and more consistent code.
  • Moves the random number generation outside the benchmarking loops.
  • Refactors to use string interpolation.

Related Issues

Does this pull request have any related issues?

This pull request:

  • resolves no related issues.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

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


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Needs Review A pull request which needs code review. labels Jan 27, 2026
@hrshya hrshya added difficulty: 1 Low degree of difficulty. Should be straightforward to implement and/or resolve. Benchmarks Pull requests adding or improving benchmarks for measuring performance. review: 4 labels Jan 27, 2026
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Jan 27, 2026

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/t/cdf $\color{red}234/236$
$\color{green}+0.00%$
$\color{red}28/29$
$\color{green}+0.00%$
$\color{green}3/3$
$\color{green}+0.00%$
$\color{red}234/236$
$\color{green}+0.00%$
stats/base/dists/t/ctor $\color{green}436/436$
$\color{green}+0.00%$
$\color{green}27/27$
$\color{green}+0.00%$
$\color{green}16/16$
$\color{green}+0.00%$
$\color{green}436/436$
$\color{green}+0.00%$
stats/base/dists/t/entropy $\color{green}171/171$
$\color{green}+0.00%$
$\color{green}8/8$
$\color{green}+0.00%$
$\color{green}2/2$
$\color{green}+0.00%$
$\color{green}171/171$
$\color{green}+0.00%$
stats/base/dists/t/kurtosis $\color{green}181/181$
$\color{green}+0.00%$
$\color{green}10/10$
$\color{green}+0.00%$
$\color{green}2/2$
$\color{green}+0.00%$
$\color{green}181/181$
$\color{green}+0.00%$
stats/base/dists/t/logcdf $\color{green}242/242$
$\color{green}+0.00%$
$\color{green}29/29$
$\color{green}+0.00%$
$\color{green}3/3$
$\color{green}+0.00%$
$\color{green}242/242$
$\color{green}+0.00%$
stats/base/dists/t/logpdf $\color{green}273/273$
$\color{green}+0.00%$
$\color{green}17/17$
$\color{green}+0.00%$
$\color{green}4/4$
$\color{green}+0.00%$
$\color{green}273/273$
$\color{green}+0.00%$
stats/base/dists/t/mean $\color{green}161/161$
$\color{green}+0.00%$
$\color{green}8/8$
$\color{green}+0.00%$
$\color{green}2/2$
$\color{green}+0.00%$
$\color{green}161/161$
$\color{green}+0.00%$
stats/base/dists/t/median $\color{green}161/161$
$\color{green}+0.00%$
$\color{green}8/8$
$\color{green}+0.00%$
$\color{green}2/2$
$\color{green}+0.00%$
$\color{green}161/161$
$\color{green}+0.00%$
stats/base/dists/t/mode $\color{green}161/161$
$\color{green}+0.00%$
$\color{green}8/8$
$\color{green}+0.00%$
$\color{green}2/2$
$\color{green}+0.00%$
$\color{green}161/161$
$\color{green}+0.00%$
stats/base/dists/t/pdf $\color{green}275/275$
$\color{green}+0.00%$
$\color{green}17/17$
$\color{green}+0.00%$
$\color{green}4/4$
$\color{green}+0.00%$
$\color{green}275/275$
$\color{green}+0.00%$
stats/base/dists/t/quantile $\color{green}229/229$
$\color{green}+0.00%$
$\color{green}23/23$
$\color{green}+0.00%$
$\color{green}3/3$
$\color{green}+0.00%$
$\color{green}229/229$
$\color{green}+0.00%$
stats/base/dists/t/skewness $\color{green}169/169$
$\color{green}+0.00%$
$\color{green}8/8$
$\color{green}+0.00%$
$\color{green}2/2$
$\color{green}+0.00%$
$\color{green}169/169$
$\color{green}+0.00%$
stats/base/dists/t/stdev $\color{green}174/174$
$\color{green}+0.00%$
$\color{green}10/10$
$\color{green}+0.00%$
$\color{green}2/2$
$\color{green}+0.00%$
$\color{green}174/174$
$\color{green}+0.00%$
stats/base/dists/t/variance $\color{green}169/169$
$\color{green}+0.00%$
$\color{green}10/10$
$\color{green}+0.00%$
$\color{green}2/2$
$\color{green}+0.00%$
$\color{green}169/169$
$\color{green}+0.00%$

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

@kgryte kgryte removed the Needs Review A pull request which needs code review. label Jan 28, 2026
});

bench( pkg+':entropy', function benchmark( b ) {
bench( format( '%s::entropy', pkg ), function benchmark( b ) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
bench( format( '%s::entropy', pkg ), function benchmark( b ) {
bench( format( '%s:entropy', pkg ), function benchmark( b ) {

This isn't correct. When benchmarking direct property access, you should only use a single colon.

});

bench( pkg+':kurtosis', function benchmark( b ) {
bench( format( '%s::kurtosis', pkg ), function benchmark( b ) {
Copy link
Member

Choose a reason for hiding this comment

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

Same comment. Applies here and elsewhere in this file.

Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

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

Apart from the benchmark naming comments, this is looking good.

@kgryte kgryte added the Needs Changes Pull request which needs changes before being merged. label Jan 28, 2026
@hrshya hrshya requested a review from kgryte January 28, 2026 17:49
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Jan 28, 2026
@kgryte kgryte removed Needs Changes Pull request which needs changes before being merged. Needs Review A pull request which needs code review. labels Jan 29, 2026
Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

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

LGTM

@kgryte kgryte merged commit b2ded58 into stdlib-js:develop Jan 29, 2026
32 checks passed
@hrshya hrshya deleted the bench/t branch January 29, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Benchmarks Pull requests adding or improving benchmarks for measuring performance. difficulty: 1 Low degree of difficulty. Should be straightforward to implement and/or resolve. review: 4 Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants