-
-
Notifications
You must be signed in to change notification settings - Fork 170
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
NameSpaceHelper: introduce namespace cache to speedup namespace lookups #939
Conversation
return TokenHelper::findNextAll($phpcsFile, T_NAMESPACE, 0); | ||
static $cache = []; | ||
|
||
$cacheKey = $phpcsFile->getFilename() . $phpcsFile->getFixedCount(); |
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.
Please see https://github.com/slevomat/coding-standard/blob/master/SlevomatCodingStandard/Helpers/UseStatementHelper.php#L123 and implement it likewise.
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.
I moved this logic to SniffLocalCache helper, what do you think about it?
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.
Nice! Just some small changes please :)
2bc79a5
to
3d0441a
Compare
@nightlinus One last change please. Squash it to one commit or move this change 3d0441a#diff-054ee9cafd168683808f20c4b5d722f1R84 to the right commit. |
rebased and squashed |
Thanks 👍 |
This pr introduce cache for namespace lookups.
This speed up for 8kloc test-case
Can this cache cause any unwanted side effects?