Skip to content
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] Cache classname collection on DynamicSourceLocatorProvider #5845

Closed
wants to merge 13 commits into from

Conversation

samsonasik
Copy link
Member

@samsonasik samsonasik commented Apr 26, 2024

Continue of PR:

this ensure classname collection on DynamicSourceLocatorProvider to be cached, ensure no more $sourceLocator->locateIdentifiersByType() if already cached, just call the $this->reflectionProvider->getClass($classNameCache)

On parallel process, the DynamicSourceLocatorDecorator always new instance due to Worker usage.

Before => 56 seconds

➜  rector-src git:(main) time bin/rector process --clear-cache 
 2176/2176 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

                                                                                                                        
 [OK] Rector is done!                                                                                                   
                                                                                                                        

bin/rector process --clear-cache  381.72s user 15.69s system 703% cpu 56.459 total

After => 32 seconds.

➜  rector-src git:(cache-classname) time bin/rector process --clear-cache
 2176/2176 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

                                                                                                                        
 [OK] Rector is done!                                                                                                   
                                                                                                                        

bin/rector process --clear-cache  221.64s user 9.05s system 716% cpu 32.190 total

@samsonasik samsonasik marked this pull request as draft April 26, 2024 20:41
@samsonasik
Copy link
Member Author

@samsonasik samsonasik closed this Apr 26, 2024
@samsonasik samsonasik deleted the cache-classname branch April 26, 2024 21:37
@samsonasik samsonasik restored the cache-classname branch April 26, 2024 23:59
@samsonasik samsonasik reopened this Apr 26, 2024
@samsonasik
Copy link
Member Author

closing for now to avoid side effect on class added side effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant