https://bugzilla.wikimedia.org/show_bug.cgi?id=72158

            Bug ID: 72158
           Summary: deep copy of Entity when calling
                    Revision::getContent()
           Product: MediaWiki extensions
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: WikidataRepo
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
       Web browser: ---
   Mobile Platform: ---

a deep copy "of Entity is made whenever calling Revision::getContent().  the
deep copy is done with "unserialize( serialize( $this ) );" which is expensive,
time and memory wise.

When saving an item, getContent() is called at least 15 times:

5x - WikiPage::getContent
1x - WikiPage::doEditContent
1x - WikiPage::prepareContentForEdit
1x - RepoHooks::onNewRevisionFromEditComplete
1x - WikiPage::isRedirect
1x - WikiPage::isCountable
2x - ChangeNotifier::notifyOnPageModification
2x - Revision::getText
2x - EchoDiscussionParser::getChangeInterpretationForRevision
1x - AbuseFilterHooks::filterEdit
1x - EntityChange::setRevisionInfo
1x - RepoHooks::notifyEntityStoreWatchersOnUpdate
1x - WikiPage::doEditUpdates
1x - Revision::checkContentModel
1x - WikiPage::updateRevisionOn

getContent might be called more times in various other extensions that I do not
have enabled currently.

When viewing or purging the item, getContent is called 5 times:

1x - WikiPage::isRedirect
1x - RepoHooks::onOutputPageBodyAttributes
1x - ViewEntityAction::show (via ContentRetriever::getContentForRequest)
1x - ViewEntityAction::isPlainView (again via
ContentRetriever::getContentForRequest)
1x - Article::fetchContentObject

possible action items are:

1) reduce the number of times getContent() is called.

2) maybe lazy initialize the full entity parameter? perhaps we can have some
sort of stubbed Entity / EntityContent object, with the entity serialization as
a variable, and then full serialize when getEntity is called? stuff like
redirect target and entity id and type might be made more easily accessible
without needing the entire entity object.

3) investigate alternatives for deep cloning the entity that are better
performance-wise, not needing to do full serialize/unserialize.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to