Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[PropertyAccess] fixes #8659 - added isAccessible() method to PropertyAccessor #9766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

[PropertyAccess] fixes #8659 - added isAccessible() method to PropertyAccessor #9766

wants to merge 1 commit into from

Conversation

arodiss
Copy link

@arodiss arodiss commented Dec 14, 2013

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #8659
License MIT
Doc PR n/a

added isAccessible() method to PropertyAccessor
Does not perform actual getting which may contain logic

* @param PropertyPath|string $propertyPath
* @return PropertyPath
* @throws Exception\UnexpectedTypeException
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the docblock for the private method

*
* @return Boolean
*/
public function isAccessible($objectOrArray, $propertyName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second argument should be $propertyPath.

@webmozart
Copy link
Contributor

Thank you for taking the time to work on this issue! :)

Your changes introduce a lot of additional method calls. That's nice in one way, because it cleans up the code a bit. But unfortunately, PropertyAccess is currently one of the bottlenecks of the Form component, so this restructuring is not acceptable - unless you can provide some metrics that prove a more or less equal performance.

@arodiss
Copy link
Author

arodiss commented Dec 30, 2013

@bschussek
I created this super-dumb tester to check performance impact: https://gist.github.com/arodiss/8181359
Resuls I achieved on master:

Action Operations per second
read on array 59061
read on ArrayAccess 61021
read with getter 35542
read with hasser 33879
read with isser 37046
read property 36658
read magic getter 31571
read magic call 27609

On my branch:

Action Operations per second
read on array 56659
read on ArrayAccess 44517
read with getter 13020
read with hasser 9577
read with isser 12818
read property 12491
read magic getter 12495
read magic call 12869

So performance degradation level is 5..60% - obviously unacceptable

@fabpot
Copy link
Member

fabpot commented Dec 31, 2013

Based on the benchmark numbers, is it safe to close this one?

@webmozart
Copy link
Contributor

@arodiss Thank you for the benchmark! You are right, this is unacceptable. If you manage to add isAccessible() while maintaining an acceptable performance level, please open a new PR.

@webmozart webmozart closed this Jan 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants