Skip to content

Commit

Permalink
Issue #3343913 by _shY, smustgrave, catch, xjm, quietone: Add comment…
Browse files Browse the repository at this point in the history
…s explaining performance improvement in TypedData

(cherry picked from commit efecede14e022885f68555df616af3e8a84e703a)
  • Loading branch information
longwave committed Nov 28, 2023
1 parent 607f985 commit d239b8a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Drupal/Core/TypedData/TypedData.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d239b8a

Please sign in to comment.