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
Performance investigation #4026
Comments
can you elaborate on that ? |
those methods are called so frequently that very minor changes can lead to walltime speed win. alternatively one could check the calling locations whether some of those calls can be saved, e.g. by using temp-variables or similar |
… (staabm, keradus) This PR was merged into the 2.12 branch. Discussion ---------- Token - inline $other->getPrototype() to speedup equals() as measured in #4026 we try to speedup equals() by inlinening the $this->getPrototype() call. ~~also we use FQCN for native functions, because equals() is called a lot.~~ this speedsup the process by 4-5%. see https://blackfire.io/profiles/compare/f4eefae8-6d09-4ab4-a833-f828d74a7b52/graph ![image](https://user-images.githubusercontent.com/120441/46916011-d6d2c400-cfb4-11e8-89e1-ec64e77477f1.png) Commits ------- 1aecb36 Token - inline $other->getPrototype() to speedup equals()
…(staabm) This PR was merged into the 2.12 branch. Discussion ---------- Tokens - inlined extractTokenKind() call on the hot path as identified in #4026 we inline calls to `extractTokenKind()` which leads to a 5-7% speed increase. most calls of this method happen thru the changed code as can be seen in the blackfire profile ![image](https://user-images.githubusercontent.com/120441/46915856-1a77fe80-cfb2-11e8-9e0c-531b88059ad4.png) Commits ------- 27c78e3 Tokens - inlined extractTokenKind() call on the hot path
Thx for merging. I am very proud to contribute to this great tool. |
Thanks for your patience as well ;) |
Awesome work on this @staabm |
while crunching together initial numbers in #4024 (comment) I did some blackfire profiles
my findings:
linting a single file:
blackfire run php ./PHP-CS-Fixer/php-cs-fixer fix ./sabre-dav/lib/CalDAV/Calendar.php
https://blackfire.io/profiles/739e8c50-2345-4f4b-a157-e94b9b220029/graph
=> PhpCsFixer\Tokenizer\Token::equals() and PhpCsFixer\Tokenizer\Token::isGivenKind() seem to be slow
linting a folder of files (pretty similar picture):
blackfire run php ./PHP-CS-Fixer/php-cs-fixer fix ./sabre-dav/lib/CalDAV/
https://blackfire.io/profiles/7db4aa88-ece8-4fd4-9850-a1a7467bf1a4/graph
=> PhpCsFixer\Tokenizer\Token::equals(), PhpCsFixer\Tokenizer\Tokens::extractTokenKind(), PhpCsFixer\Tokenizer\Tokens::offsetSet() seem to be slow
The text was updated successfully, but these errors were encountered: