bench: add missing native benchmark#13325
Merged
Merged
Conversation
Adds `benchmark/benchmark.native.js` to exercise the native N-API addon via `tryRequire( './../lib/native.js' )`, mirroring the sibling pattern already present in 342 of 343 (99.7%) native packages under `@stdlib/math/base/special` (e.g. `log1p/benchmark/benchmark.native.js`). The benchmark reuses the JS benchmark's `uniform( 100, -1.0, 99.0 )` input distribution and skips when the addon is not built.
Fixes the `Lint Copyright Years` CI check on the newly added `log1pmx/benchmark/benchmark.native.js`, which requires the current year in the copyright header for newly added files.
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
kgryte
approved these changes
Jul 6, 2026
math/base/special/log1pmx
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
Adds the missing
benchmark/benchmark.native.jsto@stdlib/math/base/special/log1pmxso its N-API addon has the same JS-level benchmark surface as its 342 siblings in@stdlib/math/base/special.Namespace summary
@stdlib/math/base/specialbinding.gyp+src/addon.c+lib/native.js); 14 are pure-JS by design.README.md,lib/index.js,lib/main.js,docs/repl.txt,docs/types/{index.d.ts,test.ts},test/test.js,benchmark/benchmark.js,examples/index.js,package.json), the standardpackage.jsonkey set, and the H2 section list (Usage,Examples,C APIsfor native packages). Among the 343 native packages,benchmark/benchmark.native.jsandtest/test.native.jsare each present at 342/343.stdlibpackage.jsonsub-key set (only 249/357 packages carry a__stdlib__block, below the 75% cutoff — likely a build-time addition, deliberately not touched here); the H2See Alsosection (237/357, generator-owned per the routine's auto-populated gate).math/base/special/log1pmxlog1pmxis the sole native package in the namespace missingbenchmark/benchmark.native.js— 342 of 343 native siblings (99.7%) carry it, including the immediate siblinglog1p. The package already ships a functional N-API addon (binding.gyp,src/{addon.c,main.c},lib/native.js), so the gap is a bookkeeping oversight from when the package was added, not an intentional deviation. The new file mirrorslog1p/benchmark/benchmark.native.jsverbatim in structure — loads the addon viatryRequire('./../lib/native.js'), skips cleanly when the addon isn't built, and reuses the JS benchmark'suniform( 100, -1.0, 99.0 )input distribution so JS and native numbers are comparable. No other file in the package changes, and nothing intest/,examples/,README.md, ordocs/repl.txt— nor anywhere else in the repo — references or depends on the file's absence.Related Issues
None.
Questions
No.
Other
Validation
package.jsonkey sets,manifest.jsonkey sets, and README H2/H3 section lists — computed the majority pattern per feature at the routine's 75% threshold.confirmed-driftfor thelog1pmxfinding.log1pmx/test/test.js(adding special-value tests) and PR docs: fix TSDoc issues across manymath/base/specialdeclarations #12467 revises TSDoc acrossmath/base/special; neither touchesbenchmark/benchmark.native.jsinlog1pmxand neither collides at the file level.Deliberately excluded:
log1pmx/test/test.native.js(also missing, 342/343 conformance). Adding it would mirrortest/test.js, which PR test: add special value tests for log1pmx #9491 is actively extending; landing atest.native.jsderived from today'stest.jswould silently omit the special-value tests once test: add special value tests for log1pmx #9491 merges. Deferred until test: add special value tests for log1pmx #9491 lands.cfloor/benchmark/c/native/{Makefile,benchmark.c}(native package, 340/343 conformance for this pair).cfloor's existingbenchmark/c/benchmark.cis a raw-C reference (callsfloor()oncreal(z)/cimag(z)); adding a stdlib-impl native benchmark would require writing ~140 lines of C that constructstdlib_complex128_tinputs and formatComplex128outputs — beyond the routine's mechanical-fix criterion.hyp2f1/benchmark/c/native/{Makefile,benchmark.c}andsqrtpif/benchmark/c/native/{Makefile,benchmark.c}(same 340/343 conformance). Both packages havebenchmark/c/benchmark.cfiles that already#include "stdlib/math/base/special/*.h"and callstdlib_base_*— content-wise they belong underbenchmark/c/native/. The correction is a directory move plus Makefile CFLAGS rework, not a pure file addition, so it needs a human call on whether to move or duplicate; dropped from this run.fastsub-namespace parent (single-outlier missinglib/main.js,benchmark/benchmark.js,docs/repl.txt). It is a namespace package, not a leaf; deviation is intentional.## See Alsosections (237/357), per the routine's auto-populated gate.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code on behalf of @Planeshifter as a cross-package drift audit of
@stdlib/math/base/special. Structural features (file trees,package.jsonshape, README sections, manifest shape) were extracted for all 357 members; majority patterns were computed at the routine's 75% threshold; the single surviving outlier finding was independently validated by three reviewer agents (opus semantic-review, opus cross-reference, sonnet structural-review). A human will audit and promote the PR out of draft.@stdlib-js/reviewers
Generated by Claude Code