Chad has uploaded a new change for review.
https://gerrit.wikimedia.org/r/177451
Change subject: Remove function-level profiling
......................................................................
Remove function-level profiling
Real developers use xhprof.
Change-Id: Ic806edb89cdfb73886e0fa1b6f0e2a4d9ebabee8
---
M includes/NearMatchPicker.php
M includes/Sanity/Checker.php
M includes/Search/Escaper.php
M includes/Searcher.php
M includes/Updater.php
M includes/Version.php
M maintenance/forceSearchIndex.php
M maintenance/updateOneSearchIndexConfig.php
8 files changed, 0 insertions(+), 49 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch
refs/changes/51/177451/1
diff --git a/includes/NearMatchPicker.php b/includes/NearMatchPicker.php
index f4c3afe..044e37b 100644
--- a/includes/NearMatchPicker.php
+++ b/includes/NearMatchPicker.php
@@ -1,7 +1,6 @@
<?php
namespace CirrusSearch;
-use \ProfileSection;
/**
* Picks the best "near match" title.
@@ -56,8 +55,6 @@
* @return Title|null title if there is a near match and null otherwise
*/
public function pickBest() {
- $profiler = new ProfileSection( __METHOD__ );
-
if ( !$this->titles ) {
return null;
}
diff --git a/includes/Sanity/Checker.php b/includes/Sanity/Checker.php
index e45b854..00ee595 100644
--- a/includes/Sanity/Checker.php
+++ b/includes/Sanity/Checker.php
@@ -3,7 +3,6 @@
namespace CirrusSearch\Sanity;
use \CirrusSearch\Connection;
use \CirrusSearch\Searcher;
-use \ProfileSection;
use \Status;
use \Title;
use \WikiPage;
diff --git a/includes/Search/Escaper.php b/includes/Search/Escaper.php
index 06cf51e..5059f94 100644
--- a/includes/Search/Escaper.php
+++ b/includes/Search/Escaper.php
@@ -2,8 +2,6 @@
namespace CirrusSearch\Search;
-use \ProfileSection;
-
/**
* Escapes queries.
*
@@ -30,7 +28,6 @@
}
public function escapeQuotes( $text ) {
- $profiler = new ProfileSection( __METHOD__ );
if ( $this->language === 'he' ) {
// Hebrew uses the double quote (") character as a
standin for quotation marks (“”)
// which delineate phrases. It also uses double quotes
as a standin for another
@@ -56,8 +53,6 @@
* at the end of the term to make sure elasticsearch doesn't barf at us.
*/
public function fixupQueryStringPart( $string ) {
- $profiler = new ProfileSection( __METHOD__ );
-
// Escape characters that can be escaped with \\
$string = preg_replace( '/(
\(| (?# no user supplied groupings)
@@ -84,8 +79,6 @@
* @return array(string, boolean) (fixedup query string, is this a
fuzzy query?)
*/
public function fixupWholeQueryString( $string ) {
- $profiler = new ProfileSection( __METHOD__ );
-
// Be careful when editing this method because the ordering of
the replacements matters.
// Escape ~ that don't follow a term or a quote
@@ -153,7 +146,6 @@
}
public function balanceQuotes( $text ) {
- $profiler = new ProfileSection( __METHOD__ );
$inQuote = false;
$inEscape = false;
$len = strlen( $text );
diff --git a/includes/Searcher.php b/includes/Searcher.php
index ee10a7c..f9c0b0d 100644
--- a/includes/Searcher.php
+++ b/includes/Searcher.php
@@ -11,7 +11,6 @@
use \CirrusSearch\Search\ResultsType;
use \Language;
use \MWNamespace;
-use \ProfileSection;
use \RequestContext;
use \Sanitizer;
use \SearchResultSet;
@@ -246,8 +245,6 @@
public function nearMatchTitleSearch( $search ) {
global $wgCirrusSearchAllFields;
- $profiler = new ProfileSection( __METHOD__ );
-
self::checkTitleSearchRequestLength( $search );
// Elasticsearch seems to have trouble extracting the proper
terms to highlight
@@ -279,8 +276,6 @@
public function prefixSearch( $search ) {
global $wgCirrusSearchPrefixSearchStartsWithAnyWord,
$wgCirrusSearchPrefixWeights;
-
- $profiler = new ProfileSection( __METHOD__ );
self::checkTitleSearchRequestLength( $search );
@@ -320,8 +315,6 @@
* @param Status(mixed) status containing results defined by
resultsType on success
*/
public function randomSearch( $seed ) {
- $profiler = new ProfileSection( __METHOD__ );
-
$this->setResultsType( new IdResultsType() );
$this->sort = 'random';
@@ -352,8 +345,6 @@
$wgCirrusSearchBoostLinks,
$wgCirrusSearchAllFields,
$wgCirrusSearchAllFieldsForRescore;
-
- $profiler = new ProfileSection( __METHOD__ );
// Transform Mediawiki specific syntax to filters and extra
(pre-escaped) query string
$searcher = $this;
@@ -791,8 +782,6 @@
public function moreLikeTheseArticles( $titles, $options =
Searcher::MORE_LIKE_THESE_NONE ) {
global $wgCirrusSearchMoreLikeThisConfig;
- $profiler = new ProfileSection( __METHOD__ );
-
// It'd be better to be able to have Elasticsearch fetch this
during the query rather than make
// two passes but it doesn't support that at this point
$pageIds = array();
@@ -836,8 +825,6 @@
* or an error if there was an error
*/
public function get( $pageIds, $sourceFiltering ) {
- $profiler = new ProfileSection( __METHOD__ );
-
$indexType = $this->pickIndexTypeFromNamespaces();
$searcher = $this;
$indexBaseName = $this->indexBaseName;
@@ -945,8 +932,6 @@
global $wgCirrusSearchMoreAccurateScoringMode,
$wgCirrusSearchSearchShardTimeout,
$wgCirrusSearchClientSideSearchTimeout;
-
- $profiler = new ProfileSection( __METHOD__ );
if ( $this->resultsType === null ) {
$this->resultsType = new FullTextResultsType(
FullTextResultsType::HIGHLIGHT_ALL );
diff --git a/includes/Updater.php b/includes/Updater.php
index b3926d3..00eb248 100644
--- a/includes/Updater.php
+++ b/includes/Updater.php
@@ -6,7 +6,6 @@
use CirrusSearch\BuildDocument\PageTextBuilder;
use \MWTimestamp;
use \ParserCache;
-use \ProfileSection;
use \Sanitizer;
use \Title;
use \WikiPage;
@@ -170,8 +169,6 @@
* @return int Number of documents updated of -1 if there was an error
*/
public function updatePages( $pages, $shardTimeout, $clientSideTimeout,
$flags ) {
- $profiler = new ProfileSection( __METHOD__ );
-
// Don't update the same page twice. We shouldn't, but meh
$pageIds = array();
$pages = array_filter( $pages, function( $page ) use (
&$pageIds ) {
@@ -224,8 +221,6 @@
* @return bool True if nothing happened or we successfully deleted,
false on failure
*/
public function deletePages( $titles, $ids, $clientSideTimeout = null,
$indexType = null ) {
- $profiler = new ProfileSection( __METHOD__ );
-
Job\OtherIndex::queueIfRequired( $titles, false );
if ( $clientSideTimeout !== null ) {
@@ -248,8 +243,6 @@
if ( $documentCount === 0 ) {
return true;
}
-
- $profiler = new ProfileSection( __METHOD__ );
$exception = null;
try {
@@ -286,8 +279,6 @@
private function buildDocumentsForPages( $pages, $flags ) {
global $wgCirrusSearchUpdateConflictRetryCount;
-
- $profiler = new ProfileSection( __METHOD__ );
$indexOnSkip = $flags & self::INDEX_ON_SKIP;
$skipParse = $flags & self::SKIP_PARSE;
@@ -508,8 +499,6 @@
* @return bool True if nothing happened or we deleted, false on failure
*/
private function sendDeletes( $ids, $indexType = null ) {
- $profiler = new ProfileSection( __METHOD__ );
-
$idCount = count( $ids );
if ( $idCount !== 0 ) {
try {
diff --git a/includes/Version.php b/includes/Version.php
index c6adcdc..fe57bcb 100644
--- a/includes/Version.php
+++ b/includes/Version.php
@@ -1,7 +1,6 @@
<?php
namespace CirrusSearch;
-use \ProfileSection;
use \Status;
/**
@@ -37,8 +36,6 @@
*/
public function get() {
global $wgMemc, $wgCirrusSearchClientSideSearchTimeout;
-
- $profiler = new ProfileSection( __METHOD__ );
$mcKey = wfMemcKey( 'CirrusSearch', 'Elasticsearch', 'version'
);
$result = $wgMemc->get( $mcKey );
diff --git a/maintenance/forceSearchIndex.php b/maintenance/forceSearchIndex.php
index 61ed117..3aa5728 100644
--- a/maintenance/forceSearchIndex.php
+++ b/maintenance/forceSearchIndex.php
@@ -7,7 +7,6 @@
use \Maintenance;
use \MWContentSerializationException;
use \MWTimestamp;
-use \ProfileSection;
use \Title;
use \WikiPage;
@@ -96,8 +95,6 @@
if ( !$this->simpleCheckIndexes() ) {
$this->error( "$wiki index(es) do not exist. Did you
forget to run updateSearchIndexConfig?", 1 );
}
-
- $profiler = new ProfileSection( __METHOD__ );
// Make sure we don't flood the pool counter
unset( $wgPoolCounterConf['CirrusSearch-Search'] );
@@ -295,7 +292,6 @@
* inputs for this function but should not by synced to the search
index.
*/
private function findUpdates( $minUpdate, $minId, $maxUpdate ) {
- $profiler = new ProfileSection( __METHOD__ );
$dbr = $this->getDB( DB_SLAVE );
$minId = $dbr->addQuotes( $minId );
if ( $maxUpdate === null ) {
@@ -349,8 +345,6 @@
}
private function decodeResults( $res, $maxUpdate ) {
- $profiler = new ProfileSection( __METHOD__ );
-
$result = array();
// Build the updater outside the loop because it stores the
redirects it hits. Don't build it at the top
// level so those are stored when it is freed.
@@ -412,7 +406,6 @@
* @return array An array of the last update timestamp and id that were
found
*/
private function findDeletes( $minUpdate, $minNamespace, $minTitle,
$maxUpdate ) {
- $profiler = new ProfileSection( __METHOD__ );
$dbr = $this->getDB( DB_SLAVE );
$minUpdate = $dbr->addQuotes( $dbr->timestamp( $minUpdate ) );
$minNamespace = $dbr->addQuotes( $minNamespace );
diff --git a/maintenance/updateOneSearchIndexConfig.php
b/maintenance/updateOneSearchIndexConfig.php
index 6daebb4..72687e0 100644
--- a/maintenance/updateOneSearchIndexConfig.php
+++ b/maintenance/updateOneSearchIndexConfig.php
@@ -5,7 +5,6 @@
use \CirrusSearch\Connection;
use \CirrusSearch\ElasticsearchIntermediary;
use Elastica;
-use \ProfileSection;
/**
* Update the search configuration on the search backend.
--
To view, visit https://gerrit.wikimedia.org/r/177451
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic806edb89cdfb73886e0fa1b6f0e2a4d9ebabee8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits