-
-
Notifications
You must be signed in to change notification settings - Fork 670
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
NameImportingPostRector is slow #8077
Comments
another thing which makes me wonder: my rector run does not yield any required changes but it seems name importing is still slow? sounds like rector does re-print files, even if no changes occurred? |
ecs is only sorting use statements iirc, not make auto imports. Some rules require print in the rule itself, like curly variable check Auto imports is expected to be slower, as it check every Name node already in use statement and its a complex one, as it also verify in group use and aliased. |
…PostRector @TomasVotruba @staabm this is to avoid unnecessary check phpdocinfo on Expr or Identifier. Ref rectorphp/rector#8077
… NameImportingPostRector (#4558) * [PostRector] Only check phpdocinfo on Stmt and Param on NameImportingPostRector @TomasVotruba @staabm this is to avoid unnecessary check phpdocinfo on Expr or Identifier. Ref rectorphp/rector#8077 * [ci-review] Rector Rectify * flip check --------- Co-authored-by: GitHub Action <actions@github.com>
@TomasVotruba do you think we can expect this type-mapping will go away when #7959 is resolved? |
@samsonasik do you think it would work to run the auto-import after all rectors have been applied instead of mid-flight as a post rector between rules? in our case |
said differently: I have the feeling out of the default post-rectors the |
PostRector is already run after all rules applied to the file object: rector/src/Application/FileProcessor/PhpFileProcessor.php Lines 108 to 110 in 7f18bf8
It is in loop of while file still changed until no longer changed. |
maybe I did not yet understand what a "auto import" is. In my understanding it means adding "use statements" for symbols which are fully-qualified within the source?
yeah. my question is, whether we can move it after the loop, as it might not be necessary todo it within it? |
Apply after loop is probably better, but that will make the We basically don't want to run multiple times, except it happen on consecutive rule execution, or reprint that require space change, that php-parser doesn't have information immediatelly after change the node. |
Bug Report
when
$rectorConfig->importNames();
is enabled running rector across the otherwise identical codebase is 42% slower.is it a known problem that
$rectorConfig->importNames()
is such a performance hit?do we actually need
$rectorConfig->importNames()
in our projects when we run ECS right after we ran rector?Minimal PHP Code Causing Issue
my rector command on the kunzmann private repo:
blackfire run php vendor/bin/rector process app/admin --ansi --clear-cache
config
Expected Behaviour
fast CI :)
The text was updated successfully, but these errors were encountered: