-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
68 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
if (!global.BigInt) { | ||
console.log('Benchmark requirest 10.x or newer.'); | ||
process.exit(0); | ||
} | ||
|
||
var assert = require('assert'); | ||
var isGlob = require('./'); | ||
|
||
function runBenchmark(length) { | ||
var start = process.hrtime.bigint(); | ||
['(', '[', '{', '\\'].forEach(function(char) { | ||
isGlob(char.repeat(length)); | ||
isGlob(char.repeat(length), {strict: false}); | ||
}); | ||
return process.hrtime.bigint() - start; | ||
} | ||
|
||
var baseline = runBenchmark(1e6); | ||
console.log('Benchmark took ' + baseline / global.BigInt(1000000) + ' milliseconds.'); | ||
|
||
assert.ok(baseline < global.BigInt(1000000000), 'Benchmark goal is less than one second'); |
This file contains 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
This file contains 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
This file contains 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