Loop is using the range function (for creating comments) which can be optimised.

File name: BigPipeRegressionTest.php
path: big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php on line no 98

foreach (range(1, 5) as $i) {
$comment = Comment::create([
'status' => CommentInterface::PUBLISHED,
'field_name' => 'comment',
'entity_type' => 'node',
'entity_id' => $node->id(),
]);
$comment->save();
}

CommentFileSizeAuthor
#4 2936339-4.patch786 bytesrajeshwari10
Members fund testing for the Drupal project. Drupal Association Learn more

Comments

alokvermaei created an issue. See original summary.

cilefen’s picture

Title: Ensure that modules using the optimised loop and should be consistent » BigPipeRegressionTest is using the range function (for creating comments) which can be optimised
Component: other » big_pipe.module
rajeshwari10’s picture

Assigned: Unassigned » rajeshwari10
rajeshwari10’s picture

Assigned: rajeshwari10 » Unassigned
Status: Active » Needs review
FileSize
786 bytes

Hi,

I have removed the range function inside the foreach and added for loop. Please Review the patch and let me know your feedback.

Thanks

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Wim Leers’s picture

Priority: Normal » Minor
Status: Needs review » Closed (works as designed)

That's … not an optimization. It's even the same amount of code, and adding a superfluous comment.

Sorry, but I'm going to close this.