From 8b197f417db6d8672f4d23c4b56e653b0575094c Mon Sep 17 00:00:00 2001 From: ksarabia Date: Tue, 3 Dec 2024 09:55:39 -0600 Subject: [PATCH] Remove unused performance metrics * Removes lines from instrumentation.js Bug: T379861 Change-Id: I2943917db477cd33fab481eaf24e50f6f01ca412 --- .../skins.vector.search/instrumentation.js | 64 +------------------ 1 file changed, 1 insertion(+), 63 deletions(-) diff --git a/resources/skins.vector.search/instrumentation.js b/resources/skins.vector.search/instrumentation.js index 4578326f9..8ec37b74c 100644 --- a/resources/skins.vector.search/instrumentation.js +++ b/resources/skins.vector.search/instrumentation.js @@ -4,37 +4,6 @@ * * @see https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/skins/Vector/+/refs/heads/master/includes/Constants.php */ -const INPUT_LOCATION_MOVED = 'header-moved', - // T251544: Collect search performance metrics to compare Vue search with - // mediawiki.searchSuggest performance. Marks and Measures will only be - // recorded on the Vector skin and only if browser supported. - shouldTestSearchPerformance = !!( window.performance && - !!performance.mark && - !!performance.measure && - !!performance.getEntriesByName && - performance.clearMarks ), - loadStartMark = 'mwVectorVueSearchLoadStart', - queryMark = 'mwVectorVueSearchQuery', - renderMark = 'mwVectorVueSearchRender', - queryToRenderMeasure = 'mwVectorVueSearchQueryToRender', - loadStartToFirstRenderMeasure = 'mwVectorVueSearchLoadStartToFirstRender'; - -function onFetchStart() { - if ( !shouldTestSearchPerformance ) { - return; - } - - // Clear past marks that are no longer relevant. This likely means that the - // search request failed or was cancelled. Whatever the reason, the mark - // is no longer needed since we are only interested in collecting the time - // from query to render. - if ( performance.getEntriesByName( queryMark ).length ) { - performance.clearMarks( queryMark ); - } - - performance.mark( queryMark ); -} - /** * @param {FetchEndEvent} event */ @@ -45,38 +14,8 @@ function onFetchEnd( event ) { // resultSetType: '', // searchId: '', query: event.query, - inputLocation: INPUT_LOCATION_MOVED + inputLocation: 'header-moved' } ); - - if ( shouldTestSearchPerformance ) { - // Schedule the mark after the search results have rendered and are - // visible to the user. Two rAF's are needed for this since rAF will - // execute before the rendering steps happen (e.g. layout and paint). A - // nested rAF will execute after these rendering steps have completed - // and ensure the search results are visible to the user. - requestAnimationFrame( () => { - requestAnimationFrame( () => { - if ( !performance.getEntriesByName( queryMark ).length ) { - return; - } - - performance.mark( renderMark ); - performance.measure( queryToRenderMeasure, queryMark, renderMark ); - - // Measure from the start of the lazy load to the first render if we - // haven't already captured that info. - if ( performance.getEntriesByName( loadStartMark ).length && - !performance.getEntriesByName( loadStartToFirstRenderMeasure ).length ) { - performance.measure( loadStartToFirstRenderMeasure, loadStartMark, renderMark ); - } - - // The measures are the most meaningful info so we remove the marks - // after we have the measure. - performance.clearMarks( queryMark ); - performance.clearMarks( renderMark ); - } ); - } ); - } } /** @@ -143,7 +82,6 @@ function addWprovToSearchResultUrls( results, offset ) { */ module.exports = { listeners: { - onFetchStart, onFetchEnd, onSuggestionClick,