Last modified: 2013-03-15 16:57:45 UTC
I noticed this in config/index.php:getLanguageList() The current method of opendir/readdir causes an excessive number of fstat calls. With network based filesystems (glusterfs specifically) this causes a lot of unnecessary delay. I propose caching the results of those lookups in session variables to reduce that impact, for example: function getLanguageList() { global $wgLanguageNames, $IP; if( isset( $_SESSION['getLanguageListcodes'] ) ) return $_SESSION['getLanguageListcodes'] if( !isset( $wgLanguageNames ) ) { require_once( "$IP/languages/Names.php" ); } $codes = array(); $d = opendir( "../languages/messages" ); /* In case we are called from the root directory */ if (!$d) $d = opendir( "languages/messages"); while( false !== ($f = readdir( $d ) ) ) { $m = array(); if( preg_match( '/Messages([A-Z][a-z_]+)\.php$/', $f, $m ) ) { $code = str_replace( '_', '-', strtolower( $m[1] ) ); if( isset( $wgLanguageNames[$code] ) ) { $name = $code . ' - ' . $wgLanguageNames[$code]; } else { $name = $code; } $codes[$code] = $name; } } closedir( $d ); ksort( $codes ); $_SESSION['getLanguageListcodes'] = $codes return $codes; }
Obviously an untested example... been doing a lot of python recently. Missed the semicolons.
Is this (if so, how) ResourceLoader related? I know there are stat calls inside ResourceLoader, but afaik those are fairly well cached. The example shown in comment looks like Installer::findExtensions.