entity constructors are inefficient
|Reported by:||ewinslow||Owned by:|
When a row is provided to the entity constructor, it ignores the contents and proceeds to fetch the row from the database using the GUID. This is highly inefficient, especially during an elgg_get_entities call. When returning 10 entities, this results in at least 21 queries (1 to fetch the entities, 10 to re-fetch the entity rows, and 10 more for each of the type-specific rows).
We should just use the given row to initialize the entity, and only fetch what we *don't* already have from the database.