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,