bench: fix bool dtype setup in empty-like and full-like benchmarks#12644
Draft
Planeshifter wants to merge 1 commit into
Draft
bench: fix bool dtype setup in empty-like and full-like benchmarks#12644Planeshifter wants to merge 1 commit into
empty-like and full-like benchmarks#12644Planeshifter wants to merge 1 commit into
Conversation
The `run_affected_benchmarks` job on `develop` failed on two recent commits with a TypeError thrown before any benchmark iteration ran. Four benchmark files used `zeros(n,'bool')` to construct the bool-typed source array passed to `emptyLike`/`fullLike`, but `@stdlib/array/zeros` only accepts dtypes in the `numeric_and_generic` category, which does not include `bool`. Replace every `zeros(n,'bool')` call with `new BooleanArray(n)` and add the `@stdlib/array/bool` require. In the two `benchmark.length.bool.js` files the `zeros` require is replaced in full, as it had no other use. In the two `benchmark.js` files the `zeros` require is retained because the remaining dtype sections continue to use it. Ref: https://github.com/stdlib-js/stdlib/actions/runs/27060639823 Ref: https://github.com/stdlib-js/stdlib/actions/runs/27060900306
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
@stdlib/array/zerosaccepts onlynumeric_and_genericdtypes.'bool'is not in that set. Four benchmark files calledzeros(n,'bool')to construct the source array for bool-typed array benchmarks, which threw aTypeErrorbefore any benchmark iteration could run.Fix: add
var BooleanArray = require('@stdlib/array/bool');to each affected file and replacezeros(n,'bool')withnew BooleanArray(n). Inbenchmark.length.bool.jsfor both packages, thezerosrequire is removed entirely because'bool'was its only call site. Inbenchmark.jsfor both packages, thezerosrequire is retained to serve the remaining numeric dtype sections.Files changed:
lib/node_modules/@stdlib/array/empty-like/benchmark/benchmark.jslib/node_modules/@stdlib/array/empty-like/benchmark/benchmark.length.bool.jslib/node_modules/@stdlib/array/full-like/benchmark/benchmark.jslib/node_modules/@stdlib/array/full-like/benchmark/benchmark.length.bool.jsRelated Issues
None.
Questions
No.
Other
Failing runs: https://github.com/stdlib-js/stdlib/actions/runs/27060639823 and https://github.com/stdlib-js/stdlib/actions/runs/27060900306
Three reviewers examined the diff. All approved with no blocking findings. Reviewer A flagged a non-blocking issue:
lib/node_modules/@stdlib/array/full-like/docs/types/index.d.tsline 330 still containszeros(2,'bool')in a TypeScript documentation example. That is a pre-existing issue in the type declaration file and is out of scope for this benchmark fix; it should be addressed in a separate PR.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code.
@stdlib-js/reviewers
Generated by Claude Code