phoenix icon indicating copy to clipboard operation
phoenix copied to clipboard

Add the hydration time in the timeline

Open stof opened this issue 11 years ago • 9 comments

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)

stof avatar Sep 07 '12 10:09 stof

could be useful: implementation of hydration profiling https://github.com/debesha/DoctrineProfileExtraBundle.

inaniyants avatar Jul 20 '15 15:07 inaniyants

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?

ostrolucky avatar Dec 01 '19 19:12 ostrolucky

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.

stof avatar Mar 17 '20 19:03 stof

ORM folks probably wouldn't like performance impact this would have, even as just abstraction with empty implementation. Hydration is expensive.

ostrolucky avatar Mar 17 '20 21:03 ostrolucky

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.

stof avatar Mar 17 '20 21:03 stof

Let's postpone until ORM has this option then. @stof is there an issue for this in ORM repository?

ostrolucky avatar Mar 18 '20 09:03 ostrolucky

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 avatar Mar 18 '20 15:03 alcaeus

@alcaeus Unfortunately that's in ODM only

ostrolucky avatar Mar 18 '20 15:03 ostrolucky

That makes it a little more complicated 😅

alcaeus avatar Mar 18 '20 15:03 alcaeus