In FeedsNodeProcessor.inc, the beginning of the process loop looks like this:

while ($item = $batch->shiftItem()) {

      // Create/update if item does not exist or update existing is enabled.
      if (!($nid = $this->existingItemId($item, $source)) || ($this->config['update_existing'] != FEEDS_SKIP_EXISTING)) {
        $node = $this->buildNode($nid, $source->feed_nid);

        // Only proceed if item has actually changed.
        $hash = $this->hash($item);
        if (!empty($nid) && $hash == $this->getHash($nid)) {
          continue;
        }
        $node->feeds_node_item->hash = $hash;

As far as I can tell there is no reason buildNode() can not go under the hash-check, avoiding a call to buildNode/node_load everytime Feeds comes across already existing data. Patch attached, all tests passing (including my application-specific tests which depend on FeedsNodeProcessor->process)

CommentFileSizeAuthor
feeds-hash-before-build.patch1.02 KBandrewlevine

Comments

alex_b’s picture

Status: Needs review » Reviewed & tested by the community

good call. RTBC.

andrewlevine’s picture

Yep, should be ready to commit. We have been using this patch in development of our application for a while now.

alex_b’s picture

Title: buildNode() (and node_load()) called unnecessarily - performance » Fix buildNode() (and node_load()) called unnecessarily
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.