Skip to content

Commit 63d2fd3

Browse files
committed
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
1 parent e1b8e98 commit 63d2fd3

2 files changed

Lines changed: 72 additions & 0 deletions

File tree

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var instanceOf = require( '@stdlib/assert/instance-of' );
25+
var format = require( '@stdlib/string/format' );
26+
var pkg = require( './../package.json' ).name;
27+
var CompactAdjacencyMatrix = require( './../lib' );
28+
29+
30+
// MAIN //
31+
32+
bench( format( '%s::instantiation,new', pkg ), function benchmark( b ) {
33+
var adj;
34+
var i;
35+
36+
b.tic();
37+
for ( i = 0; i < b.iterations; i++ ) {
38+
adj = new CompactAdjacencyMatrix( 10 );
39+
if ( typeof adj !== 'object' ) {
40+
b.fail( 'should return an object' );
41+
}
42+
}
43+
b.toc();
44+
if ( !instanceOf( adj, CompactAdjacencyMatrix ) ) {
45+
b.fail( 'should return an instance' );
46+
}
47+
b.pass( 'benchmark finished' );
48+
b.end();
49+
});
50+
51+
bench( format( '%s::instantiation,no_new', pkg ), function benchmark( b ) {
52+
var compactAdjacencyMatrix;
53+
var adj;
54+
var i;
55+
56+
compactAdjacencyMatrix = CompactAdjacencyMatrix;
57+
58+
b.tic();
59+
for ( i = 0; i < b.iterations; i++ ) {
60+
adj = compactAdjacencyMatrix( 10 );
61+
if ( typeof adj !== 'object' ) {
62+
b.fail( 'should return an object' );
63+
}
64+
}
65+
b.toc();
66+
if ( !instanceOf( adj, CompactAdjacencyMatrix ) ) {
67+
b.fail( 'should return an instance' );
68+
}
69+
b.pass( 'benchmark finished' );
70+
b.end();
71+
});

lib/node_modules/@stdlib/dstructs/compact-adjacency-matrix/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
],
1616
"main": "./lib",
1717
"directories": {
18+
"benchmark": "./benchmark",
1819
"doc": "./docs",
1920
"example": "./examples",
2021
"lib": "./lib",

0 commit comments

Comments
 (0)