Last modified: 2013-04-22 16:15:37 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 T41665, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 39665 - Cache ApiQuery->makeGeneratorList so it doesn't autoload all query classes on every request
Cache ApiQuery->makeGeneratorList so it doesn't autoload all query classes on...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.20.x
All All
: Unprioritized minor (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-26 12:44 UTC by Domas Mituzas
Modified: 2013-04-22 16:15 UTC (History)
6 users (show)

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


Attachments
profiler image (105.34 KB, image/png)
2012-08-26 12:44 UTC, Domas Mituzas
Details

Description Domas Mituzas 2012-08-26 12:44:00 UTC
Created attachment 11009 [details]
profiler image

This check for 'is a generator' is quite expensive for ApiQuery - as it has to load all class files to resolve it:

	private function makeGeneratorList( $moduleList ) {
		foreach( $moduleList as  $moduleName => $moduleClass ) {
			if ( is_subclass_of( $moduleClass, 'ApiQueryGeneratorBase'  ) ) {

It may make sense to build generator list in somewhat lighter way. 

This is ends up being 30%+ of API setup cost for simple API queries, e.g. api.php?action=query&format=txt

Attaching profiler image.
Comment 1 Sam Reed (reedy) 2012-08-26 15:40:39 UTC
Yay, reflection. Done like this, it's always going to be costly

This is at least somewhat better than it was (changed recently), in some cases, where this list would be created twice...

We stick this in some apc (maybe the simplest way), or memcached, though that feels slightly strange

Other than that, I suppose we could have this defined in code, rather than the current resultant iteration over $wgAPIPropModules and $wgAPIListModules
Comment 2 Sam Reed (reedy) 2012-08-26 17:18:54 UTC
(In reply to comment #1)
> We stick this in some apc (maybe the simplest way), or memcached, though that
> feels slightly strange

Though, it would need to vary on dbname, due to various different extensions being enabled on different wikis...


Also, removing the reflection inference is a bit of a "breaking change", requiring extension authors to update their extensions where necessary.,
Comment 3 Domas Mituzas 2012-08-27 11:50:04 UTC
introducing reflection inference is already a breaking change :-)
Comment 4 Sam Reed (reedy) 2012-08-27 15:49:33 UTC
(In reply to comment #3)
> introducing reflection inference is already a breaking change :-)

It's not new, just has been refactored...
Comment 5 Sam Reed (reedy) 2012-09-05 22:31:24 UTC
https://gerrit.wikimedia.org/r/22837

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


Navigation
Links