Improving performance with Field Collections? I'm using using entity reference, field collection , and field collection table modules on a site that features "courses" and "lessons" as content types. A field collection with unlimited values is embedded in the course content type, and it contains two fields: a text field for "section" and an entity reference field for "lesson". This allows the same lessons to be reused in different courses, while appearing under a different section. (see screen for reference).

This works pretty well, but performance when editing course nodes starts to degrade significantly after about 30 lessons are added to a course. At 100 lessons, it takes about 15 seconds to load a course for editing. With 140 lessons in a course, it takes about 22 seconds to edit a course node. I'm testing locally on a new D7 test site with devel-generated content.

Questions:

(1) Are there any obvious steps I should take to improve performance with field collections?

(2) As an alternative to field collections, would creating a compound field in code likely improve performance significantly?

(3) For testing performance generally, is there a simple profiling tool I can use with Drupal?

Example of a small course with 10 lessons added as field collections:
Update: In the end, I abandoned field collections and created a custom compound field that is attached to the 'course' content type. 

This pretty much eliminated the performance problems. Opening a course node with 130 lessons in the field now takes 3-6 seconds, depending on the server.

And because the field is unlimited multivalue, the delta works a sorting mechanism for the lessons in views, etc.

I also added code to add more than one item at a time as seen here: 

Slow &quot;Add another item&quot; with unlimited valued fields

When there are a lot of items in the field, adding a new item ends up taking a lot of time.

Good resources:


http://www.phase2technology.com/blog/compound-fields-in-drupal-7/
https://drupal.org/project/examples (field example)
https://api.drupal.org/api/drupal/modules!field!field.api.php/7