Skip to content

Commit 2b906dc

Browse files
committed
Add benchmark
1 parent 45095b2 commit 2b906dc

File tree

1 file changed

+22
-0
lines changed
  • lib/node_modules/@stdlib/utils/constructor-name/benchmark

1 file changed

+22
-0
lines changed

lib/node_modules/@stdlib/utils/constructor-name/benchmark/benchmark.js

+22
Original file line numberDiff line numberDiff line change
@@ -339,3 +339,25 @@ bench( pkg+'::regexp', function benchmark( b ) {
339339
b.pass( 'benchmark finished' );
340340
b.end();
341341
});
342+
343+
bench( pkg+'::function', function benchmark( b ) {
344+
var str;
345+
var v;
346+
var i;
347+
348+
v = isString;
349+
350+
b.tic();
351+
for ( i = 0; i < b.iterations; i++ ) {
352+
str = constructorName( v );
353+
if ( !isString( str ) ) {
354+
b.fail( 'should return a string' );
355+
}
356+
}
357+
b.toc();
358+
if ( !isString( str ) ) {
359+
b.fail( 'should return a string' );
360+
}
361+
b.pass( 'benchmark finished' );
362+
b.end();
363+
});

0 commit comments

Comments
 (0)