phoenix
phoenix copied to clipboard
Add the hydration time in the timeline
Currently, the doctrine
timing in the timeline panel is only the DBAL time. The ORM time should be tracked too (it may require adding some logging points in the ORM)
could be useful: implementation of hydration profiling https://github.com/debesha/DoctrineProfileExtraBundle.
I think such feature would be welcome addition, if hidden behind optional switch. Perhaps @debesha would be interested in contributing it here, so he doesn't have to maintain his own repository?
Well, I think we should strive for having a clean extension point in the ORM to build this feature, rather than the bunch of hacks needed in DoctrineProfileExtraBundle.
ORM folks probably wouldn't like performance impact this would have, even as just abstraction with empty implementation. Hydration is expensive.
well, if they allow decorating hydrators in an official way, this could be a cost you pay only when the feature is used (and I think the additional cost will be small compared to the hydration itself).
Currently, when looking at the webprofiler timeline panel, we see some timing for Doctrine, but this is really only the DBAL time. And when using Blackfire, I regularly see the hydration time being longer than the time spent executing the SQL query, so this is something important to show to users.
Let's postpone until ORM has this option then. @stof is there an issue for this in ORM repository?
Technically, there is an extension point: the HydratorFactory. It's not that easy to do but it can be done: new TimingHydratorFactory
wraps the original factory and creates new Hydrators that wrap originals, including timing logic in the StopWatch component. If anyone wants to give this a shot, be my guest. This could also be contributed back to ORM as an optional feature, although I have my doubts that it will be accepted.
@alcaeus Unfortunately that's in ODM only
That makes it a little more complicated 😅