Last modified: 2014-02-11 13:40:13 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T63045, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 61045 - Category->getName and Categry->getID hit DB even if they already have the requested info
Category->getName and Categry->getID hit DB even if they already have the req...
Status: NEW
Product: MediaWiki
Classification: Unclassified
Categories (Other open bugs)
1.23.0
All All
: Normal normal (vote)
: ---
Assigned To: Sam Smith
: performance
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-07 18:11 UTC by Matthew Flaschen
Modified: 2014-02-11 13:40 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Matthew Flaschen 2014-02-07 18:11:58 UTC
getName and getID use a generic function getX.  That checks if the overall instance is initialized (doing so if it wasn't).  Then it returns the requested info.

However, this is inefficient, since in some cases it already has that info.

For example, if you do:

$c = Category::newFromName( $catName );
...
$canonicalizedCatName = $c->getName()

it will hit the DB even though it already has the canonical name.

It should be lazy, and only hit it if it doesn't have the required info.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links