From efecede14e022885f68555df616af3e8a84e703a Mon Sep 17 00:00:00 2001 From: Dave Long <dave@longwaveconsulting.com> Date: Tue, 28 Nov 2023 22:50:14 +0000 Subject: [PATCH] Issue #3343913 by _shY, smustgrave, catch, xjm, quietone: Add comments explaining performance improvement in TypedData --- core/lib/Drupal/Core/TypedData/TypedData.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/lib/Drupal/Core/TypedData/TypedData.php b/core/lib/Drupal/Core/TypedData/TypedData.php index 438494b48cf5..27dd1d57344d 100644 --- a/core/lib/Drupal/Core/TypedData/TypedData.php +++ b/core/lib/Drupal/Core/TypedData/TypedData.php @@ -175,6 +175,10 @@ public function getPropertyPath() { // The property path of this data object is the parent's path appended // by this object's name. $prefix = $this->parent->getPropertyPath(); + // Variables in double quotes used to leverage fast string concatenation. + // In PHP 7+ concatenation with variable inside string is the fastest. + // @see https://blog.blackfire.io/php-7-performance-improvements-encapsed-strings-optimization.html + // This is being done because the code can run in the critical path. return $prefix !== '' ? "{$prefix}.{$this->name}" : $this->name; } // If no parent is set, this is the root of the data tree. Thus the property -- GitLab