Skip to content

bench: fix bool dtype setup in empty-like and full-like benchmarks#12644

Draft
Planeshifter wants to merge 1 commit into
developfrom
philipp/ci-fix-array-empty-like-benchmark-bool-2026-06-06
Draft

bench: fix bool dtype setup in empty-like and full-like benchmarks#12644
Planeshifter wants to merge 1 commit into
developfrom
philipp/ci-fix-array-empty-like-benchmark-bool-2026-06-06

Conversation

@Planeshifter
Copy link
Copy Markdown
Member

Description

@stdlib/array/zeros accepts only numeric_and_generic dtypes. 'bool' is not in that set. Four benchmark files called zeros(n,'bool') to construct the source array for bool-typed array benchmarks, which threw a TypeError before any benchmark iteration could run.

Fix: add var BooleanArray = require('@stdlib/array/bool'); to each affected file and replace zeros(n,'bool') with new BooleanArray(n). In benchmark.length.bool.js for both packages, the zeros require is removed entirely because 'bool' was its only call site. In benchmark.js for both packages, the zeros require is retained to serve the remaining numeric dtype sections.

Files changed:

  • lib/node_modules/@stdlib/array/empty-like/benchmark/benchmark.js
  • lib/node_modules/@stdlib/array/empty-like/benchmark/benchmark.length.bool.js
  • lib/node_modules/@stdlib/array/full-like/benchmark/benchmark.js
  • lib/node_modules/@stdlib/array/full-like/benchmark/benchmark.length.bool.js

Related 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.ts line 330 still contains zeros(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

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

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

This PR was authored by Claude Code.


@stdlib-js/reviewers


Generated by Claude Code

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
@stdlib-bot
Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
array/empty-like $\color{green}107/107$
$\color{green}+100.00\%$
$\color{green}7/7$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}107/107$
$\color{green}+100.00\%$
array/full-like $\color{green}124/124$
$\color{green}+100.00\%$
$\color{green}14/14$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}124/124$
$\color{green}+100.00\%$

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants