Project

General

Profile

Actions

Task #54525

closed

Epic #55070: Workpackages

Epic #55065: WP: Overall System Performance (Backend and Frontend)

Story #55078: Optimize PHP code performance in TYPO3 methods

Optimize file- and path functions in GeneralUtility

Added by Michiel Roos almost 11 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Performance
Target version:
Start date:
2013-12-20
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.3
Tags:
Complexity:
easy
Sprint Focus:

Description

Optimize several frequently called methods:
  • getFileAbsFileName()
  • validPathStr()
  • isAllowedAbsPath()
  • verifyFilenameAgainstDenyPattern()
Actions #1

Updated by Gerrit Code Review almost 11 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26505

Actions #2

Updated by Gerrit Code Review almost 11 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26505

Actions #3

Updated by Gerrit Code Review almost 11 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26505

Actions #4

Updated by Gerrit Code Review almost 11 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26505

Actions #5

Updated by Gerrit Code Review almost 11 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26505

Actions #6

Updated by Gerrit Code Review almost 11 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26505

Actions #7

Updated by Gerrit Code Review almost 11 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26505

Actions #8

Updated by Gerrit Code Review almost 11 years ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26505

Actions #9

Updated by Georg Ringer almost 11 years ago

so what is the measured benefit?

Actions #10

Updated by Michiel Roos almost 11 years ago

I'll post some stats this evening.

These methods are being called a lot during the frontend rendering and backend rendering. Parsing and concatenating JS and CSS and generating cache files etc.

But to give you a rough impression. These are the current call counts for an uncached backend request (/typo3/backend.php), right after clearing all cache:

Times are inclusive wall time.

TYPO3\CMS\Core\Utility\GeneralUtility::isAllowedAbsPath - 2.267 calls - 364,98 ms
TYPO3\CMS\Core\Utility\GeneralUtility::validPathStr     - 2.315 calls - 168,77 ms
TYPO3\CMS\Core\Utility\GeneralUtility::isAbsPath        - 4.598 calls -  77,33 ms
TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath  -   608 calls -  23,03 ms

The total wall time was 10,43 s here . . . mostly taken by file_put_contents(), rename(), chgrp() etc.

Reduction in call times with the patch:

TYPO3\CMS\Core\Utility\GeneralUtility::isAllowedAbsPath - 67,30 ms
TYPO3\CMS\Core\Utility\GeneralUtility::validPathStr     -  9,19 ms
TYPO3\CMS\Core\Utility\GeneralUtility::isAbsPath        - 33,97 ms
TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath  -  2,32 ms

Actions #11

Updated by Michiel Roos almost 11 years ago

Here is a test for the isAbsPath function to get an impression: http://pastebin.com/0BqyVGrc

Actions #12

Updated by Ernesto Baschny almost 11 years ago

  • Target version changed from next-patchlevel to 6.2.0
  • Parent task set to #55078
Actions #13

Updated by Gerrit Code Review almost 11 years ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26505

Actions #14

Updated by Gerrit Code Review almost 11 years ago

Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26505

Actions #15

Updated by Gerrit Code Review almost 11 years ago

Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26505

Actions #16

Updated by Gerrit Code Review almost 11 years ago

Patch set 12 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26505

Actions #17

Updated by Gerrit Code Review almost 11 years ago

Patch set 13 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26505

Actions #18

Updated by Michiel Roos almost 11 years ago

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

Updated by Riccardo De Contardi about 7 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF