From 63d2fd3e3a5e185c392f5cb7a86da7b7ec5d5e98 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 27 Apr 2026 04:20:04 +0000 Subject: [PATCH] style: align `dstructs/compact-adjacency-matrix` with namespace conventions Added missing `benchmark/benchmark.js` (present in 87.5% of `dstructs` siblings) with an instantiation-only scaffold matching the boilerplate used by sibling benchmarks (Apache header, `format()`-based bench label, `b.tic`/`b.toc`/`b.pass`/`b.end`); added `directories.benchmark` entry to `package.json` (present in 87.5% of siblings). https://claude.ai/code/session_01Y3Xf8psrX9CDj1KvW8f9xC --- .../benchmark/benchmark.js | 71 +++++++++++++++++++ .../compact-adjacency-matrix/package.json | 1 + 2 files changed, 72 insertions(+) create mode 100644 lib/node_modules/@stdlib/dstructs/compact-adjacency-matrix/benchmark/benchmark.js diff --git a/lib/node_modules/@stdlib/dstructs/compact-adjacency-matrix/benchmark/benchmark.js b/lib/node_modules/@stdlib/dstructs/compact-adjacency-matrix/benchmark/benchmark.js new file mode 100644 index 000000000000..f884db4369f0 --- /dev/null +++ b/lib/node_modules/@stdlib/dstructs/compact-adjacency-matrix/benchmark/benchmark.js @@ -0,0 +1,71 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var instanceOf = require( '@stdlib/assert/instance-of' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var CompactAdjacencyMatrix = require( './../lib' ); + + +// MAIN // + +bench( format( '%s::instantiation,new', pkg ), function benchmark( b ) { + var adj; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + adj = new CompactAdjacencyMatrix( 10 ); + if ( typeof adj !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( !instanceOf( adj, CompactAdjacencyMatrix ) ) { + b.fail( 'should return an instance' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( format( '%s::instantiation,no_new', pkg ), function benchmark( b ) { + var compactAdjacencyMatrix; + var adj; + var i; + + compactAdjacencyMatrix = CompactAdjacencyMatrix; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + adj = compactAdjacencyMatrix( 10 ); + if ( typeof adj !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( !instanceOf( adj, CompactAdjacencyMatrix ) ) { + b.fail( 'should return an instance' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/dstructs/compact-adjacency-matrix/package.json b/lib/node_modules/@stdlib/dstructs/compact-adjacency-matrix/package.json index 79ea204cb5df..4e595d43a754 100644 --- a/lib/node_modules/@stdlib/dstructs/compact-adjacency-matrix/package.json +++ b/lib/node_modules/@stdlib/dstructs/compact-adjacency-matrix/package.json @@ -15,6 +15,7 @@ ], "main": "./lib", "directories": { + "benchmark": "./benchmark", "doc": "./docs", "example": "./examples", "lib": "./lib",