Skip to content
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

Adding Collection::compile as a way to optimize operations with a single collection #2565

Merged
merged 2 commits into from
Dec 29, 2013

Conversation

lorenzo
Copy link
Member

@lorenzo lorenzo commented Dec 28, 2013

After the talk in IRC about streaming results I thought it would be nice to consolidate all results from an internal iterator into another collection. Also, I realized that by nesting iterators there would be a chance of wasting CPU by calculating stuff twice if the same variable is used.

This introduces Collection::compile(), a way of copying the results of toArray() from a collection into a new one in order to consolidate internal operations and to easily make iterators that would not rewind, rewindable

* $allButJohn = $compiled->filter($johnMatcher);
* }}}
*
* In the above example, had not the collection compiled before, the iterations
Copy link
Member

Choose a reason for hiding this comment

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

'had the collection not been compiled before'

lorenzo added a commit that referenced this pull request Dec 29, 2013
Adding Collection::compile as a way to optimize operations with a single collection
@lorenzo lorenzo merged commit d483a63 into 3.0 Dec 29, 2013
@lorenzo lorenzo deleted the 3.0-collection-compile branch December 29, 2013 10:24
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.

3 participants