-
-
Notifications
You must be signed in to change notification settings - Fork 327
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
TwigPreLexer: improve performance #1175
Conversation
@@ -259,6 +263,10 @@ private function consumeAttributes(string $componentName): string | |||
*/ | |||
private function consume(string $string): bool | |||
{ | |||
if ($string[0] !== $this->input[$this->position]) { | |||
return false; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both of these changes make a lot of sense - and love seeing the Blackfire profile to back them up. Thanks Gregor! |
I am wondering if, in some projects, people have custom Twig namespaces that may point to directories with other things in them (like images). But indeed, I hadn't looked at HOW long the time was in those screenshots - 40 seconds is still a crazy amount of time. After these changes, what percentage of your cache:warmup is from the pre-lexer? Is it not almost nothing or still very high (i.e. it still requires several seconds)? |
Only 236.
In my case there is nothing special (afaik). Default directory structure with
Yes and it is really annoying while developing. Usually I don't use
With the change in This is the profile with both improvements: https://blackfire.io/profiles/50cca928-b5ca-4b0d-9064-7f698727a932/graph I really don't know why it is so slow on my machine. But I think it is not a problem of symfony-ux. I need to analyze this further. |
Do you have many anonymous components ? Or are they in majority class-based ? |
When using the
cache:warmup
command in my symfony project, 25% of the time is used by the TwigPreLexer:This PR reduces the time of the
cache:warmup
command by 28% in my project (which does not use the html component syntax so far):