Skip to content

Conversation

@calebdw
Copy link
Contributor

@calebdw calebdw commented Jul 25, 2025

This improves performance by avoiding unnecessary iterations when the level is already reached.

This improves performance by avoiding unnecessary iterations
when the level is already reached.
@calebdw calebdw force-pushed the calebdw/push-xpvyzrzwnkzx branch from cf1a1c7 to 9211ecb Compare July 25, 2025 15:44
@calebdw calebdw changed the title perf: break out of lookp instead of continuing perf: break out of loop instead of continuing Jul 25, 2025
@TomasVotruba
Copy link
Member

Nice one 👍 Thank you

@TomasVotruba TomasVotruba merged commit 826973c into rectorphp:main Jul 25, 2025
47 checks passed
@calebdw calebdw deleted the calebdw/push-xpvyzrzwnkzx branch July 25, 2025 15:53
@calebdw
Copy link
Contributor Author

calebdw commented Jul 25, 2025

@TomasVotruba, while debugging, I noticed that this loop was being executed multiple times while rector was running---I would have only expected this loop to be executed once at the start of the analysis. Is there a reason for this or is this an inefficiency / bug?

I wanted some insight into what the latest rule was as I'm increasing the php levels so I added a dump call right before the break:

image

@TomasVotruba
Copy link
Member

TomasVotruba commented Jul 25, 2025

Most like it's parallel run, where each thread has isolated context.

@calebdw
Copy link
Contributor Author

calebdw commented Jul 25, 2025

I am running parallel so that makes sense---but I would still only expect the number of threads that are running (~16).

Is rector rebuilt during the analysis?

@TomasVotruba
Copy link
Member

Depends. The number of cores doesn't always equal number of threads.

There is one process that invokes child process.
That's usually with explicit list of X files. Once these X files are finished, it returns json result and dies.

This happens untill all files are done. That means there are 16 threads, but they run Y processes over and over, until all files are done. Y can be huge :) at least that's how I understand it.

This might help:

@github-actions
Copy link
Contributor

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants