LinkedOpenOmeka Optimization

Hey Patrick, your LinkedOpenOmeka plugin looks pretty cool, but I found a couple of areas that you could optimize.

In particular, whenever you loop through models, if possible, you should release those objects. For example, instead of:

foreach($items as $item) {
//whatever you want to do with item

you should do:

foreach($items as $item) {
//whatever you want to do with item

// release the item from memory

Also, if at all possible, you should not use $items = get_db()->getTable('Item')->findAll();

because depending on how many items you have, you create a giant array of item.
Instead, you try to move through a smaller subset of the items, one subset at a time, until you get all of the items.

Many thanks! I'll work on changes, and will ask if I run into questions/confusion.


Thanks again. regarding just getting subsets, would you do it something like this, or is there a better way at it?

$table = get_db()->getTable('Item');
$limit = 10;
$page = 1;
$results = $table->findBy(array(), $limit, $page )
while ($results != null) {
    //process the results
    $results = $table->findBy(array(), 10, $page

Thanks again!