Skip to content

Commit 1835679

Browse files
committed
Merge remote-tracking branch 'perf-ce/ACPT-815' into ACPT-809
2 parents a81646e + 33158de commit 1835679

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/code/Magento/Elasticsearch/Model/Adapter/BatchDataMapper/ProductDataMapper.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,11 @@ private function getValuesLabels(Attribute $attribute, array $attributeValues, i
370370
return $attributeLabels;
371371
}
372372

373+
// array_flip() + foreach { isset() } is much faster than foreach { in_array() } when there are many options
374+
$attributeValues = array_flip($attributeValues);
375+
373376
foreach ($options as $option) {
374-
if (\in_array($option['value'], $attributeValues)) {
377+
if (isset($attributeValues[$option['value']])) {
375378
$attributeLabels[] = $option['label'];
376379
}
377380
}

0 commit comments

Comments
 (0)