-
-
Notifications
You must be signed in to change notification settings - Fork 394
[TwigComponent] Improve ComponentFactory performances #2344
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
Conversation
|
false positive for fabbot |
|
When running let's say frankenphp, this will always stay in memory? |
|
Thanks for this optimization! However I'm thinking, not now but maybe for a next PR, but do you think things can be more improved if this "find mounts methods" process was done during a cache warmer and persisted in cache? private function mount(object $component, array &$data): void
{
if ($component instanceof AnonymousComponent) {
$component->mount($data);
return;
}
+ if (!self::$hasMountMethod[$component::class]) {
+ return;
+ }
if (!\array_key_exists($component::class, self::$mountMethods)) {
try {
$mountMethod = self::$mountMethods[$component::class] = (new \ReflectionClass($component))->getMethod('mount');
} catch (\ReflectionException) {
self::$mountMethods[$component::class] = false;
return;
}
}WDYT? |
Absolutely! I'm moving step by step, a bit in the blind. The biggest change is yet to come (this week hopefully). This is why i'm only doing work on private/internal methods for now. Once we have the results i'm targetting, a clean will be very welcome (required?).. We will then see how to name these classes / methods, and how we can rearrange the whole thing 👍 |
Would it be a problem ? Genuine question here :) |
|
Depends on how much memory it will use. ResetInterface could be used to cleanup after request |
|
Updated! |
2298e19 to
6486933
Compare
ComponentFactory Quick Optimization
Minor change with.. mid impact
(on large number of renders)