Reflection to Closure bind rework #5808

Closed
opened 2026-01-22 15:18:30 +01:00 by admin · 4 comments
Owner

Originally created by @KonstantinKuklin on GitHub (Dec 17, 2017).

Originally assigned to: @Majkl578 on GitHub.

Did anyone tried to move from reflection to ClosureBind in cases when we need to work with entity`s property?
Main reason of such refactoring is much better performance of closures.
BTW https://ocramius.github.io/blog/accessing-private-php-class-members-without-reflection/

Originally created by @KonstantinKuklin on GitHub (Dec 17, 2017). Originally assigned to: @Majkl578 on GitHub. Did anyone tried to move from reflection to ClosureBind in cases when we need to work with entity`s property? Main reason of such refactoring is much better performance of closures. BTW https://ocramius.github.io/blog/accessing-private-php-class-members-without-reflection/
admin added the ImprovementWon't Fix labels 2026-01-22 15:18:30 +01:00
admin closed this issue 2026-01-22 15:18:32 +01:00
Author
Owner

@Ocramius commented on GitHub (Dec 17, 2017):

Usually leads to worse performance, but please check
ocramius/generated-hydrator if your aim is improving ORM performance for 3.x

On 17 Dec 2017 15:09, "Konstantin" notifications@github.com wrote:

Did anyone tried to move from reflection to ClosureBind in cases when we
need to work with entity`s property?
Main reason of such refactoring is much better performance of closures.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/6899, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakGLshGd0UZ9KZ4h2g9rrWd7arXP1ks5tBSCHgaJpZM4REqwn
.

@Ocramius commented on GitHub (Dec 17, 2017): Usually leads to worse performance, but please check ocramius/generated-hydrator if your aim is improving ORM performance for 3.x On 17 Dec 2017 15:09, "Konstantin" <notifications@github.com> wrote: > Did anyone tried to move from reflection to ClosureBind in cases when we > need to work with entity`s property? > Main reason of such refactoring is much better performance of closures. > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > <https://github.com/doctrine/doctrine2/issues/6899>, or mute the thread > <https://github.com/notifications/unsubscribe-auth/AAJakGLshGd0UZ9KZ4h2g9rrWd7arXP1ks5tBSCHgaJpZM4REqwn> > . >
Author
Owner

@KonstantinKuklin commented on GitHub (Dec 17, 2017):

So, I got:

ClosureHydrator: 0.58397507667542
Zend\Hydrator\ArraySerializable: 0.59179091453552 (+1.3383855188826%)
Zend\Hydrator\Reflection: 0.63898396492004 (+9.419732184085%)
Zend\Hydrator\ClassMethods: 5.5945200920105 (+858.00665395863%)

hydrator code: https://gist.github.com/KonstantinKuklin/c44daa558dcdfb5cee8e0d89c778c5d3

environment: PHP 7.0.22 (cli) (built: Aug 7 2017 14:07:27) ( NTS )

is 5-10% boost enough to move from reflection?

@KonstantinKuklin commented on GitHub (Dec 17, 2017): So, I got: > **ClosureHydrator**: 0.58397507667542 > Zend\Hydrator\ArraySerializable: 0.59179091453552 (+1.3383855188826%) > Zend\Hydrator\Reflection: 0.63898396492004 (+9.419732184085%) > Zend\Hydrator\ClassMethods: 5.5945200920105 (+858.00665395863%) hydrator code: https://gist.github.com/KonstantinKuklin/c44daa558dcdfb5cee8e0d89c778c5d3 environment: PHP 7.0.22 (cli) (built: Aug 7 2017 14:07:27) ( NTS ) is 5-10% boost enough to move from reflection?
Author
Owner

@Ocramius commented on GitHub (Dec 17, 2017):

No, needs to be much more to justify the change there. As I already
mentioned, the GeneratedHydrator project is where you might want to suggest
improvements.

After those are applied, we can work towards plugging in a (de-) hydration
abstraction in the ORM too.

On 17 Dec 2017 17:54, "Konstantin" notifications@github.com wrote:

So, I got:

ClosureHydrator: 0.58397507667542 <05839%207507667542>
Zend\Hydrator\ArraySerializable: 0.59179091453552 <0591%2079091453552>
(+1.3383855188826%)
Zend\Hydrator\Reflection: 0.63898396492004 <06389%208396492004>
(+9.419732184085%)
Zend\Hydrator\ClassMethods: 5.5945200920105 (+858.00665395863%)

hydrator code: https://gist.github.com/KonstantinKuklin/
c44daa558dcdfb5cee8e0d89c778c5d3

environment: PHP 7.0.22 (cli) (built: Aug 7 2017 14:07:27) ( NTS )

is 5-10% boost enough to move from reflection?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/6899#issuecomment-352269348,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakCNvATBlIhUZaq4YmlQK1-qFLqGLks5tBUc2gaJpZM4REqwn
.

@Ocramius commented on GitHub (Dec 17, 2017): No, needs to be much more to justify the change there. As I already mentioned, the GeneratedHydrator project is where you might want to suggest improvements. After those are applied, we can work towards plugging in a (de-) hydration abstraction in the ORM too. On 17 Dec 2017 17:54, "Konstantin" <notifications@github.com> wrote: > So, I got: > > *ClosureHydrator*: 0.58397507667542 <05839%207507667542> > Zend\Hydrator\ArraySerializable: 0.59179091453552 <0591%2079091453552> > (+1.3383855188826%) > Zend\Hydrator\Reflection: 0.63898396492004 <06389%208396492004> > (+9.419732184085%) > Zend\Hydrator\ClassMethods: 5.5945200920105 (+858.00665395863%) > > hydrator code: https://gist.github.com/KonstantinKuklin/ > c44daa558dcdfb5cee8e0d89c778c5d3 > > environment: PHP 7.0.22 (cli) (built: Aug 7 2017 14:07:27) ( NTS ) > > is 5-10% boost enough to move from reflection? > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <https://github.com/doctrine/doctrine2/issues/6899#issuecomment-352269348>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/AAJakCNvATBlIhUZaq4YmlQK1-qFLqGLks5tBUc2gaJpZM4REqwn> > . >
Author
Owner

@Majkl578 commented on GitHub (Dec 19, 2017):

We actually already have issue for generated hydrators: #2553. I'll close this one based on what @Ocramius said, but will add the other issue to 3.0 milestone so it doesn't get forgotten.

@Majkl578 commented on GitHub (Dec 19, 2017): We actually already have issue for generated hydrators: #2553. I'll close this one based on what @Ocramius said, but will add the other issue to 3.0 milestone so it doesn't get forgotten.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5808