export function _ensurePerformance(): void {
  // performance polyfill. Copied from https://gist.github.com/paulirish/5438650

  // https://gist.github.com/paulirish/5438650
  // @license http://opensource.org/licenses/MIT
  // copyright Paul Irish 2015

  if ('performance' in self === false) {
    self.performance = {};
  }

  Date.now = (Date.now || function() {
    return new Date().getTime();
  });

  if ('now' in self.performance === false) {
    let nowOffset = Date.now();

    if (performance.timing && performance.timing.navigationStart) {
      nowOffset = performance.timing.navigationStart;
    }

    self.performance.now = function now() {
      return Date.now() - nowOffset;
    };
  }
}

@@ -698,11 +698,2075 @@
   %7D;%0A  %7D
+%0A%0A  const startOffset = Date.now ? Date.now() : + (new Date);%0A  const _entries = %5B%5D;%0A  const _marksIndex = %7B%7D;%0A%0A  function _filterEntries(key, value) %7B%0A    var i = 0, n = _entries.length, result = %5B%5D;%0A    for (; i %3C n; i++) %7B%0A      if (_entries%5Bi%5D%5Bkey%5D == value) %7B%0A        result.push(_entries%5Bi%5D);%0A      %7D%0A    %7D%0A    return result;%0A  %7D%0A%0A  function _clearEntries(type, name) %7B%0A    var i = _entries.length, entry;%0A    while (i--) %7B%0A      entry = _entries%5Bi%5D;%0A      if (entry.entryType == type && (name === void 0 %7C%7C entry.name == name)) %7B%0A        _entries.splice(i, 1);%0A      %7D%0A    %7D%0A  %7D;%0A%0A  if (!self.performance.mark) %7B%0A    self.performance.mark = self.performance.webkitMark %7C%7C function (name) %7B%0A      const mark = %7B%0A        name,%0A        entryType: %22mark%22,%0A        startTime: self.performance.now(),%0A        duration: 0%0A      %7D;%0A%0A      _entries.push(mark);%0A      _marksIndex%5Bname%5D = mark;%0A    %7D;%0A  %7D%0A%0A%0A  if (!self.performance.measure) %7B%0A    self.performance.measure = self.performance.webkitMeasure %7C%7C function (name, startMark, endMark) %7B%0A      startMark = _marksIndex%5BstartMark%5D.startTime;%0A      endMark = _marksIndex%5BendMark%5D.startTime;%0A%0A      _entries.push(%7B%0A        name,%0A        entryType: %22measure%22,%0A        startTime: startMark,%0A        duration: endMark - startMark%0A      %7D);%0A    %7D;%0A  %7D%0A%0A%0A  if (!self.performance.getEntriesByType) %7B%0A    self.performance.getEntriesByType = self.performance.webkitGetEntriesByType %7C%7C function (type) %7B%0A      return _filterEntries(%22entryType%22, type);%0A    %7D;%0A  %7D%0A%0A%0A  if (!self.performance.getEntriesByName) %7B%0A    self.performance.getEntriesByName = self.performance.webkitGetEntriesByName %7C%7C function (name) %7B%0A      return _filterEntries(%22name%22, name);%0A    %7D;%0A  %7D%0A%0A%0A  if (!self.performance.clearMarks) %7B%0A    self.performance.clearMarks = self.performance.webkitClearMarks %7C%7C function (name) %7B%0A      _clearEntries(%22mark%22, name);%0A    %7D;%0A  %7D%0A%0A%0A  if (!self.performance.clearMeasures) %7B%0A    self.performance.clearMeasures = self.performance.webkitClearMeasures %7C%7C function (name) %7B%0A      _clearEntries(%22measure%22, name);%0A    %7D;%0A%7D
 %0A%7D%0A

update for the performance api