Hi!

We have some cases where we're importing products (meaning product display nodes) with up to 300 variations (Commerce product entities). In these cases it's a terrible resource waste to do calls to commerce_product_load_by_sku on every single value iteration.

I'm attaching a patch that adds a bit of intelligence and loads all the SKUs being imported into the product reference field, saves them to an array keyed by SKU and only then iterates over the full set of values.

For our import in some cases it dropped the time needed to import one product display node by an order of magnitude. Of course in situations where every product display node contains 1-2 commerce products, the benefits are nonexistant, but in anything larger than that, knocking off a significant amount of loads should make the import a lot smoother.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pcambra’s picture

Status: Needs review » Fixed

I agree this would help and won't harm small loads, but the main slowness lives in the update itself, see #1420346: Accumulative product reference mapper performance

Committing this, thanks!

Status: Fixed » Closed (fixed)

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