Created
October 17, 2016 17:06
-
-
Save kebot/fd756cbe1212d6f955bbbf13db6680d7 to your computer and use it in GitHub Desktop.
time
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
// matchfilters performance: https://github.com/yarnpkg/yarn/blob/master/src/util/filter.js#L96 | |
const path = require('path'); | |
let filter = { | |
base: 'node_modules/xml-escape', | |
isNegation: false, | |
regex: /^(?:(?!\.)(?=.)[^\/]*?\.seed)$/i | |
}, | |
basename = 'branches', | |
loc = '.git/branches' | |
let startTime = Date.now() | |
if (filter.base && filter.base !== '.') { | |
loc = path.relative(filter.base, loc); | |
} | |
filter.regex.test(loc) || | |
filter.regex.test(`/${loc}`) || | |
filter.regex.test(basename); | |
console.log('timediff', Date.now() - startTime); | |
>>> timediff 19ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment