ux icon indicating copy to clipboard operation
ux copied to clipboard

[LiveComponent] Performance issue with `LiveComponentMetadataFactory::createLivePropMetadata`

Open Kocal opened this issue 6 months ago • 3 comments

While we were talking with @mtarld, we noticed the method LiveComponentMetadataFactory::createLivePropMetadata could be optimized.

For a given class name and property name, the result will always be the same, meaning we don't have to re-compute the LivePropMetadata|LegacyLivePropMetadata each time this method is called, especially by the LiveComponentHydrator.

The result could be put in static-cache or maybe in a filesystem cache (e.g.: if introducing a warmup system).

Kocal avatar Jun 06 '25 09:06 Kocal

When playing with https://ux.symfony.com/demos/live-memory/, we can see the 7 calls to createLivePropMetadata each time we interact with the live component: Image

I didn't profile the code yet, but if your app has many users, it can definitely be interesting :)

EDIT: in my local env, that's between ~10ms and ~20ms for the LiveMemory:* and InvoiceCreator* live components. That's not much, but relying on Reflection during the runtime is not super efficient. I will see to cache-warm the up!

Kocal avatar Jun 06 '25 16:06 Kocal

Absolutely! The Hydrator needs to be split into separated responsabilities, if you're looking at related things after this one 😓

smnandre avatar Jun 06 '25 18:06 smnandre

Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?

carsonbot avatar Dec 07 '25 12:12 carsonbot