Skip to content

RenameFunctionRector: prevent repeated isName() calls#5003

Merged
samsonasik merged 2 commits intorectorphp:mainfrom
staabm:less-naming
Sep 12, 2023
Merged

RenameFunctionRector: prevent repeated isName() calls#5003
samsonasik merged 2 commits intorectorphp:mainfrom
staabm:less-naming

Conversation

@staabm
Copy link
Copy Markdown
Contributor

@staabm staabm commented Sep 12, 2023

because it showed up in codeigniter profiles

grafik

grafik

@staabm
Copy link
Copy Markdown
Contributor Author

staabm commented Sep 12, 2023

tested on codeigniter4 codebase:

before this PR:

time php vendor/bin/rector process tests --dry-run --clear-cache
 326/326 [============================] 100%

 [OK] Rector is done!

real    0m58.909s
user    0m0.000s
sys     0m0.031s

after this PR

 time php vendor/bin/rector process tests --dry-run --clear-cache
 326/326 [============================] 100%

 [OK] Rector is done!

real    0m54.508s
user    0m0.031s
sys     0m0.015s

=> 7-8% faster

@samsonasik samsonasik merged commit cbc632c into rectorphp:main Sep 12, 2023
@samsonasik
Copy link
Copy Markdown
Member

Thank you @staabm

@staabm staabm deleted the less-naming branch September 12, 2023 11:58
@staabm
Copy link
Copy Markdown
Contributor Author

staabm commented Sep 12, 2023

interessting side-effect: it seems because we do less isName() calls, we also do less reflection stuff which - in case we reflect on a identifier which does not exit - consumes more memory: (on the codeigniter4 codebase)

grafik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants