-
Notifications
You must be signed in to change notification settings - Fork 4
perf(gulp-bem-src): cache level introspection #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
// try-catch optimization | ||
function tryCatch(tryFn, catchFn) { | ||
try { | ||
tryFn(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets test, I think it may not catch async functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wont' catch throws in callbacks, but will catch async function
s afair.
* @param {*} bemConfig | ||
* @returns {Introspection} | ||
*/ | ||
module.exports = async (levelPaths, bemConfig, { cache=false } = {}) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JSDoc doesn't has options and cache description.
|
||
const introspect = introspectLevel(levelPath, bemConfig); | ||
|
||
levelCache[levelPath] = introspect; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets invert if.
Let save in cache with cache=true, and read always if exists
} | ||
})) | ||
.on('error', reject) | ||
.on('finish', () => resolve(entityMap)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on → once?
* @param {Object} entity | ||
* @returns {Iterator} | ||
*/ | ||
*entityFiles(entity) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filesByEntity
"vinyl": "2.1.0" | ||
}, | ||
"devDependencies": { | ||
"@bem/sdk.naming.entity.parse": "^0.2.4", | ||
"@bem/sdk.naming.presets": "^0.0.7" | ||
"@bem/sdk.naming.presets": "^0.0.7", | ||
"stream-to-array": "2.3.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
крышечки долой, гринкипер в помощь
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А где тесты, хоть один
entityFiles.add(file); | ||
} | ||
|
||
opts.introspection = new Introspection(['<level-path>'], [entityMap]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is <level-path>
?
Судя по тому, что я вижу, просел профицит, надо понять где мы теряем время, это лучше, чем было, но в gulp-bem/gulp-bem-src#23 в 4 раза быстрее. |
No description provided.