Project

General

Profile

Actions

Task #54091

closed

Epic #55070: Workpackages

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

Story #55078: Optimize PHP code performance in TYPO3 methods

Use === operator instead of strlen() to check for zero length strings

Added by Markus Klein over 10 years ago. Updated over 5 years ago.

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

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
medium
Sprint Focus:

Description

Use the === operator instead of the strlen() function to check for strings of length zero.

This can give a performance improvement of factor 3.

Short note: Although some source claim that strlen() has O(1), for some reason the comparison against an empty string is still faster.

Nevertheless, besides the possible performance improvement, this change also improves readability.


Related issues 5 (0 open5 closed)

Related to TYPO3 Core - Bug #65239: Missing (string) cast or isset() check in HTMLparserClosedMarkus Klein2015-02-23

Actions
Related to TYPO3 Core - Bug #67034: Content Slide: slide.collect issues since 7.1.0ClosedBenni Mack2015-05-19

Actions
Related to TYPO3 Core - Bug #84434: TypoScript ifBlank does not work with strlen like expectedRejectedStefan Froemken2018-03-17

Actions
Has duplicate TYPO3 Core - Task #64199: Cleanup usage of strlen()Closed2015-01-09

Actions
Precedes TYPO3 Core - Bug #67040: Backend broken on PostgreSQL - missing (string) cast in dbal/DatabaseConnectionClosed2015-05-19

Actions
Actions

Also available in: Atom PDF