Skip to content

Conversation

@coderimus
Copy link
Contributor

@coderimus coderimus commented Jan 14, 2018

Description

In this PR I removed the count() method from condition section for some loops. When this method is used in the loop condition it will be executed every iteration which is not so good for process time (performance).

Fixed Issues (if relevant)

N/A

Manual testing scenarios

N/A

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@ihor-sviziev ihor-sviziev self-assigned this Jan 14, 2018
@ishakhsuvarov
Copy link
Contributor

Hi @coderimus
Please take a look at the unit test failures.

$expression = trim($expression);
foreach ($this->_operations as $operation) {
$splittedExpr = preg_split('/\\' . $operation . '/', $expression, -1, PREG_SPLIT_DELIM_CAPTURE);
if (count($splittedExpr) > 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that old check would not pass if $splittedExpr is and array with 1 element, while new one would pass.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ishakhsuvarov thank you for your review! You are totally right. Fix uploaded.

@coderimus
Copy link
Contributor Author

@ishakhsuvarov requested changes added. Please, review them when this will be suitable for you :)

@ishakhsuvarov
Copy link
Contributor

Thanks @coderimus
Will review and proceed with the merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants