PersistentCollection::count() improvements #543

wants to merge 4 commits into


None yet

3 participants


PersistentCollection::count() method consumes too much memory and time when there are many referenced documents. It queries and hydrates referenced documents and uses ArrayCollection::count() method to get quantity of result elements instead of executing count command into database.

This PR improves PersistentCollection::count() method. New behavior:

  • it executes database count command when collection is InverseSide and not inititalized yet
  • uses ArrayCollection::count() method in an opposite way
jwage commented Apr 28, 2013

Cool. Looks like a nice change! 👍

jmikola commented Jun 6, 2013

Thanks for the PR. I'm going to hold off on including this in BETA9 because there will be some collection refactoring coming up and I'd like to integrate this with those changes.

In the meantime, there is a gh543 branch with this PR rebased atop master (there were some small conflicts), if anyone would like to grab the change for personal use.

jmikola commented Aug 1, 2013

See: #649.

@jmikola jmikola closed this Aug 1, 2013
@sergponomaryov sergponomaryov deleted the sergponomaryov:persistent-collection-count branch Aug 1, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment