Bug #42723

Reflection\ObjectAccess consumes to much processing time

Added by Steffen Ritter almost 9 years ago. Updated over 8 years ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
Reflection
Target version:
-
Start date:
2012-11-06
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Yes
Complexity:

Description

JsonView, Validation, Serialisation and many other parts of Flow use ObjectAccess to retrieve information about how to access properties within the current object.

getAvailableGetters for example is called thousands of times, when putting an object hirarchy of 150 fuel stations with each one address and 3 opening entries (therefore 750 objects in a nested hirarchy) first into validation and than output it as JSON.

After compile (e.g. php is running) - the properties of an Object are immutable (despite stdClass). Therefore the ObjectAccess class should use a runtime cache.


Related issues

Related to TYPO3.Flow - Bug #46491: ObjectAccess::getProperty() does not work for getters in ArrayAccessResolvedBastian Waidelich2013-03-21

Actions
#1

Updated by Gerrit Code Review almost 9 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16234

#2

Updated by Steffen Ritter almost 9 years ago

btw: this reduces the execution time within ObjectAccess from > 40% to below 10% in the given example

#3

Updated by Gerrit Code Review almost 9 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16234

#4

Updated by Gerrit Code Review almost 9 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16234

#5

Updated by Gerrit Code Review almost 9 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16234

#6

Updated by Gerrit Code Review almost 9 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16234

#7

Updated by Gerrit Code Review almost 9 years ago

Patch set 6 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16234

#8

Updated by Gerrit Code Review almost 9 years ago

Patch set 7 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16234

#10

Updated by Bastian Waidelich over 8 years ago

I didn't manage to test this while it was hot, but now I realized that this breaks the Form framework (and probably some more).
In my case FormRuntime::getCurrentPage() always returns NULL – because FormRuntime implements \ArrayAccess but $formRuntime['currentPage'] returns FALSE.

To reproduce create a class extending \ArrayAccess and providing some additional custom getter. This getter can't be called via ObjectAccess

#11

Updated by Bastian Waidelich over 8 years ago

A simple test case to reproduce this:

$arrayObject = new \ArrayObject();
var_dump($arrayObject->getIteratorClass());
var_dump(\TYPO3\Flow\Reflection\ObjectAccess::getProperty($arrayObject, 'iteratorClass'));

Should output "ArrayIterator" twice, but the second time an exception #1263391473: The property "iteratorClass" on the subject was not accessible is thrown.
Commenting out 113 & 114 in ObjectAccess fixes this issue for me.

I'll write tests and push a follow up

#12

Updated by Gerrit Code Review over 8 years ago

Patch set 1 for branch composer has been pushed to the review server.
It is available at https://review.typo3.org/19347

#13

Updated by Steffen Ritter over 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF