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] Ensure call $reflector->reflectAllClasses() once on Worker take 3 #5878

Merged
merged 6 commits into from
May 14, 2024

Conversation

samsonasik
Copy link
Member

@mfn @dorrogeray here another effort to improve performance of DynamicSourceLocatorProvider, make it on Cache object and save collection of classnames into cache, so $reflector->reflectAllClasses(), later, only calls the $this->reflectionProvider->getClass() from cache class names.

Closes rectorphp/rector#8637
Closes rectorphp/rector#8638

Before

➜  rector-src git:(main) time bin/rector     
 2180/2180 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

                                                                                                                        
 [OK] Rector is done!                                                                                                   
                                                                                                                        

bin/rector  387.45s user 14.97s system 690% cpu 58.319 total

After

➜  rector-src git:(cache-class-names) time bin/rector process --clear-cache
 2180/2180 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

                                                                                                                        
 [OK] Rector is done!                                                                                                   
                                                                                                                        

bin/rector process --clear-cache  303.96s user 12.57s system 641% cpu 49.342 total

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba I am merging it to have faster feedback to test ;)

@samsonasik samsonasik merged commit 50407e2 into main May 14, 2024
42 checks passed
@samsonasik samsonasik deleted the cache-class-names branch May 14, 2024 19:22
@samsonasik
Copy link
Member Author

@mfn @dorrogeray please try latest dev-main, it should be better now :), I will keep on if there is a better way to improve it. Current latest on rector-src code base itself:

Before 58.689 seconds

time bin/rector process --clear-cache
 2180/2180 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

                                                                                                                        
 [OK] Rector is done!                                                                                                   
                                                                                                                        

bin/rector process --clear-cache  377.52s user 16.85s system 671% cpu 58.689 total

After 48.629 seconds

time bin/rector process --clear-cache
 2180/2180 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

                                                                                                                        
 [OK] Rector is done!                                                                                                   
                                                                                                                        

bin/rector process --clear-cache  302.21s user 12.61s system 647% cpu 48.629 total

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