plugins/restiming.js
/**
	 * Compresses an array of ResourceTiming-like objects (those with a fetchStart
	 * and a responseStart/responseEnd) by reducing multiple objects with the same
	 * fetchStart down to a single object with the longest duration.
	 *
	 * Array must be pre-sorted by fetchStart, then by responseStart||responseEnd
	 *
	 * @param [ResourceTiming[]] resources ResourceTiming-like resources, with just
	 *  a fetchStart and responseEnd
	 *
	 * @returns Duration, in milliseconds
	 */
Compresses an array of ResourceTiming-like objects (those with a fetchStart
and a responseStart/responseEnd) by reducing multiple objects with the same
fetchStart down to a single object with the longest duration.

Array must be pre-sorted by fetchStart, then by responseStart||responseEnd

@param [ResourceTiming[]] resources ResourceTiming-like resources, with just
a fetchStart and responseEnd

@returns Duration, in milliseconds
Compresses an array of ResourceTiming - like objects ( those with a fetchStart and a responseStart / responseEnd ) by reducing multiple objects with the same fetchStart down to a single object with the longest duration . Array must be pre - sorted by fetchStart then by responseStart||responseEnd @param [ ResourceTiming [] ] resources ResourceTiming - like resources with just a fetchStart and responseEnd @returns Duration in milliseconds
function reduceFetchStarts(resources) {
		var times = [];
		if (!resources || !resources.length) {
			return times;
		}
		for (var i = 0; i < resources.length; i++) {
			var res = resources[i];
			if (i !== resources.length - 1 &&
				res.fetchStart === resources[i + 1].fetchStart) {
				continue;
			}
			times.push({
				fetchStart: res.fetchStart,
				responseEnd: res.responseStart || res.responseEnd
			});
		}
		return times;
	}
function reduceFetchStarts ( resources ) { var times = [ ] ; if ( ! resources || ! resources . length ) { return times ; } for ( var i = 0 ; i < resources . length ; i ++ ) { var res = resources [ i ] ; if ( i !== resources . length - 1 && res . fetchStart === resources [ i + 1 ] . fetchStart ) { continue ; } times . push ( { fetchStart : res . fetchStart , responseEnd : res . responseStart || res . responseEnd } ) ; } return times ; }
Compresses an array of ResourceTiming-like objects (those with a fetchStart
 and a responseStart/responseEnd) by reducing multiple objects with the same
 fetchStart down to a single object with the longest duration.
Compresses an array of ResourceTiming - like objects ( those with a fetchStart and a responseStart / responseEnd ) by reducing multiple objects with the same fetchStart down to a single object with the longest duration .
// if there is a subsequent resource with the same fetchStart, use // its value instead (since pre-sort guarantee is that it's end // will be >= this one) // track just the minimum fetchStart and responseEnd