Skip to content

[LiveComponent] Performance issue with LiveComponentMetadataFactory::createLivePropMetadata #2824

@Kocal

Description

@Kocal
Member

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).

Activity

Kocal

Kocal commented on Jun 6, 2025

@Kocal
MemberAuthor

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!

smnandre

smnandre commented on Jun 6, 2025

@smnandre
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @smnandre@Kocal@carsonbot

        Issue actions

          [LiveComponent] Performance issue with `LiveComponentMetadataFactory::createLivePropMetadata` · Issue #2824 · symfony/ux