Bottleneck in computeAssociationChanges()?

Details

Description

It seems that since DDC-600 computeAssociationChanges() iterate over entries of an collections, even if they are not marked as cascadePersist. For large, hydrated collections this could potentially become a bottleneck.

Wouldn't it be better to save the "addedEntities" in an additional map inside "PersistentCollection" and retrieve those instead of calling $value->unwrap() ?

Do you have any numbers to back this up? With large, hydrated collections the bottlenecks are likely elsewhere (SQL query, hydration)

Further, maintaining "addedEntities" is not as trivial as you might think. The current approach does not care about what happens in-between, it just computes a diff between the old and new state of the collection at commit time. Tracking added/removed objects as they come in and go is more cumbersome.

Roman S. Borschel
added a comment - 24/Jul/10 4:47 AM - edited Do you have any numbers to back this up? With large, hydrated collections the bottlenecks are likely elsewhere (SQL query, hydration)
Further, maintaining "addedEntities" is not as trivial as you might think. The current approach does not care about what happens in-between, it just computes a diff between the old and new state of the collection at commit time. Tracking added/removed objects as they come in and go is more cumbersome.