Skip to content

Fix extract method to avoid recalculating count() for each iteration. #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

miclf
Copy link
Contributor

@miclf miclf commented Nov 29, 2013

Cache the value of count($attributes) to avoid recalculating it for each iteration of the loop.

Since this count will never change during the method execution, this change make the code a bit more efficient.

Cache the value of `count($attributes)` to avoid recalculating it for each iteration of the loop.

Since this count will never change during the method execution, this change make the code a bit more efficient.
@fabpot fabpot closed this Nov 29, 2013
fabpot added a commit to symfony/symfony that referenced this pull request Nov 29, 2013
…ach iteration. (fabpot)

This PR was submitted for the master branch but it was merged into the 2.2 branch instead (closes #9651).

Discussion
----------

Fix `extract` method to avoid recalculating count() for each iteration.

This PR was submitted on the symfony/DomCrawler read-only repository and moved automatically to the main Symfony repository (closes symfony/dom-crawler#16).

Cache the value of `count($attributes)` to avoid recalculating it for each iteration of the loop.

Since this count will never change during the method execution, this change make the code a bit more efficient.

Commits
-------

9ababf4 Fix `extract` method to avoid recalculating count() for each iteration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants