Adrian Lang has uploaded a new change for review. https://gerrit.wikimedia.org/r/126235
Change subject: Remove slow array_unique from ReferencedEntitesFinder ...................................................................... Remove slow array_unique from ReferencedEntitesFinder The array in question is filled with EntityIds, which are expensive to compare. Change-Id: I08898a36f8582aec3560216ab48da94a465911ca --- M lib/includes/ReferencedEntitiesFinder.php 1 file changed, 5 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/35/126235/1 diff --git a/lib/includes/ReferencedEntitiesFinder.php b/lib/includes/ReferencedEntitiesFinder.php index 5ed157b..1d70d4d 100644 --- a/lib/includes/ReferencedEntitiesFinder.php +++ b/lib/includes/ReferencedEntitiesFinder.php @@ -30,7 +30,8 @@ foreach ( $snaks as $snak ) { // all of the Snak's properties are referenced entities, add them: - $foundEntities[] = $snak->getPropertyId(); + $propertyId = $snak->getPropertyId(); + $foundEntities[ $propertyId->getSerialization() ] = $propertyId; // PropertyValueSnaks might have a value referencing an Entity, find those as well: if( $snak instanceof PropertyValueSnak ) { @@ -46,7 +47,7 @@ } } - return array_unique( $foundEntities ); + return $foundEntities; } /** @@ -61,8 +62,9 @@ switch( $dataValue->getType() ) { case 'wikibase-entityid': if( $dataValue instanceof EntityIdValue ) { + $entityId = $dataValue->getEntityId(); return array( - $dataValue->getEntityId() ); + $entityId->getSerialization() => $entityId ); } break; -- To view, visit https://gerrit.wikimedia.org/r/126235 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I08898a36f8582aec3560216ab48da94a465911ca Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Adrian Lang <adrian.l...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits