Bug #42723
Reflection\ObjectAccess consumes to much processing time
Added by Steffen Ritter over 8 years ago.
Updated almost 8 years ago.
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.
- Status changed from New to Under Review
btw: this reduces the execution time within ObjectAccess from > 40% to below 10% in the given example
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
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
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Also available in: Atom
PDF