27644[TASK] try isset($array[$key]) before array_key_exists())
Commit message
Review
-
Code review CR 0
-
Verified V 0
Issues 1
Files 61
- typo3/sysext/backend/Classes/Controller/BackendController.php+1 −1
- typo3/sysext/backend/Classes/Form/DataPreprocessor.php+3 −1
- typo3/sysext/backend/Classes/Module/ModuleController.php+2 −1
- typo3/sysext/backend/Classes/Search/LiveSearch/LiveSearch.php+2 −1
- typo3/sysext/backend/Classes/Search/LiveSearch/QueryParser.php+3 −1
- typo3/sysext/backend/Classes/Tree/Pagetree/Commands.php+2 −1
- typo3/sysext/core/Classes/Core/CliBootstrap.php+1 −1
- typo3/sysext/core/Classes/DataHandling/DataHandler.php+1 −1
- typo3/sysext/core/Classes/Http/AjaxRequestHandler.php+2 −2
- typo3/sysext/core/Classes/Log/Writer/SyslogWriter.php+2 −1
- typo3/sysext/core/Classes/Resource/Driver/DriverRegistry.php+2 −2
- typo3/sysext/core/Classes/Resource/Index/Indexer.php+1 −1
- typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php+1 −1
- typo3/sysext/core/Classes/Resource/AbstractFile.php+1 −1
- typo3/sysext/core/Classes/Resource/File.php+3 −3
- typo3/sysext/core/Classes/Resource/FileReference.php+2 −1
- typo3/sysext/core/Classes/Resource/ProcessedFile.php+7 −3
- typo3/sysext/core/Classes/Resource/ResourceFactory.php+2 −1
- typo3/sysext/core/Classes/Utility/ArrayUtility.php+1 −1
- typo3/sysext/dbal/Classes/Database/DatabaseConnection.php+3 −3
Show 41 more files
- typo3/sysext/extbase/Classes/Error/Result.php+2 −1
- typo3/sysext/extbase/Classes/Object/Container/Container.php+5 −3
- typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php+3 −2
- typo3/sysext/extbase/Classes/Property/TypeConverter/ObjectConverter.php+3 −2
- typo3/sysext/extbase/Classes/Reflection/ClassSchema.php+1 −1
- typo3/sysext/extbase/Classes/Reflection/ObjectAccess.php+1 −1
- typo3/sysext/extbase/Classes/Service/ExtensionService.php+2 −1
- typo3/sysext/extbase/Classes/Service/FlexFormService.php+2 −2
- typo3/sysext/extbase/Classes/Service/TypoScriptService.php+1 −1
- typo3/sysext/extbase/Classes/Utility/ArrayUtility.php+3 −2
- typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/ArrayAccessClass.php+1 −1
- typo3/sysext/extensionmanager/Classes/Domain/Model/DownloadQueue.php+8 −5
- typo3/sysext/extensionmanager/Classes/Domain/Model/Extension.php+1 −1
- typo3/sysext/extensionmanager/Classes/Domain/Repository/ConfigurationItemRepository.php+1 −1
- typo3/sysext/extensionmanager/Classes/Report/ExtensionStatus.php+3 −3
- typo3/sysext/extensionmanager/Classes/Service/ExtensionManagementService.php+2 −2
- typo3/sysext/extensionmanager/Classes/Utility/ConfigurationUtility.php+1 −1
- typo3/sysext/extensionmanager/Classes/Utility/DependencyUtility.php+5 −2
- typo3/sysext/extensionmanager/Classes/ViewHelpers/InstallationStateCssClassViewHelper.php+1 −1
- typo3/sysext/filelist/Classes/FileList.php+1 −1
- typo3/sysext/fluid/Classes/Core/Parser/TemplateParser.php+8 −5
- typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractViewHelper.php+1 −1
- typo3/sysext/fluid/Classes/Core/ViewHelper/Arguments.php+1 −1
- typo3/sysext/fluid/Classes/Core/ViewHelper/TagBuilder.php+1 −1
- typo3/sysext/fluid/Classes/Core/ViewHelper/TemplateVariableContainer.php+2 −2
- typo3/sysext/form/Classes/Domain/Model/Element/AbstractElement.php+1 −1
- typo3/sysext/form/Classes/Domain/Model/Element/CheckboxElement.php+1 −1
- typo3/sysext/form/Classes/Domain/Model/Element/SelectElement.php+1 −1
- typo3/sysext/form/Classes/Domain/Model/Form.php+1 −1
- typo3/sysext/frontend/Classes/ContentObject/Menu/JavaScriptMenuContentObject.php+1 −1
- typo3/sysext/frontend/Classes/ContentObject/Menu/MenuContentObjectFactory.php+1 −1
- typo3/sysext/frontend/Classes/ContentObject/FluidTemplateContentObject.php+1 −1
- typo3/sysext/indexed_search/Classes/Hook/CrawlerHook.php+3 −1
- typo3/sysext/install/Classes/FolderStructure/DirectoryNode.php+1 −1
- typo3/sysext/install/Classes/FolderStructure/RootNode.php+1 −1
- typo3/sysext/install/Classes/Updates/AbstractUpdate.php+1 −1
- typo3/sysext/install/Classes/Updates/InstallSysExtsUpdate.php+1 −1
- typo3/sysext/recycler/Classes/Domain/Model/DeletedRecords.php+2 −2
- typo3/sysext/reports/Classes/Report/Status/Typo3Status.php+2 −2
- typo3/sysext/scheduler/Classes/Task/TableGarbageCollectionAdditionalFieldProvider.php+2 −1
- typo3/sysext/version/Classes/Hook/DataHandlerHook.php+4 −1
Review log 11
-
Michiel Roos wrote 02/16/14, 21:00
Topic set to "performance". -
Mr. Jenkins commented on patch set 1 02/16/14, 21:18
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/14087/ : SUCCESS https://ci.typo3.org/job/typo3-v4-core-gerrit/14086/ : SUCCESS -
Jo Hasenau voted on patch set 1 CR +1 02/17/14, 15:55
-
Markus Klein commented on patch set 1 02/17/14, 16:21
I'm not 100% convinced by this change. Is the speed gain big enough to justify the big increase of code? -
Michiel Roos commented on patch set 1 02/17/14, 21:05
Markus, Did you ever try to take a look at the Backend Log module? This is the reason I went down this path. There are around a million method calls going on in there. About 931.908 on a good day. All to render 500 records of log with links to a history detail page if appropriate. After applying this patch (and using a language construct over a more expensive PHP function), for the Backend Log, a reduction by 19.041 method calls is measured. That's 2%. Memory usage is reduced by about 17% for the Backend Log request. But please feel free to measure for yourself too. There may be areas where more performance increase can be had though. 931.908 calls too much for my taste. -
Markus Klein commented on patch set 1 02/17/14, 22:03
Honestly I rarely show more than 200 entries in the belog. ;-) But this a valid argument of course. Can you add you findings to the forge ticket as well, please? Will we do another iteration to get rid of the unnecessary array_key_exists() calls for all of the situations where we do not encounter NULL values in array? -
Michiel Roos commented on patch set 1 02/17/14, 22:20
Added comment to the ticket. I'm not sure where we can and can't expect NULLs. I thought it a safer bet to just use the OR and a fallback to the array_key_exists() in case the isset returns FALSE. It is true of course that this will only help the cases where the $key we are checking actually is set. If it is not, the array_key_exists will be called as well as isset. So yes, it would be nice to clean this up some more. -
Tomita Militaru voted on patch set 1 CR +1 06/14/14, 09:36
-
Marc Wöhlken commented on patch set 1 CR -1 06/20/14, 12:23
I see why the change is wanted but would prefer to do it in another way. The speed improvement generated by isset() may be a temporary effect that might not be true for future php versions. What about extending TYPO3\CMS\Core\Utility\ArrayUtility? IMHO there would be a great place to add a array_key_exists() replacement. When this is done each array_key_exists() call could be replace by TYPO3\CMS\Core\Utility\ArrayUtility::array_key_exists(). This would enable us to centrally manage the handling of array_key_exists() but may be a little bit slower than the proposed solution. -
Jo Hasenau commented on patch set 1 06/20/14, 13:21
Well - adding a wrapper method to a native PHP function for a performance related patch IMHO is a no go, since it increases memory consumption and CPU load, which is what we actually want to avoid with this patch. Even if future PHP versions might have improved array_key_exists performance, it is not very likely that it will beat isset in the end. And if it does, we can still change the code accordingly. -
Markus Klein abandoned the change 03/14/15, 14:02
Abandoning this patch since there hasn't been progress for more than a year now. Additionally the solution must be to use isset() and ONLY use array_key_exists() where necessary. This means that we have to do case-by-case inspections here.