<commit_before>(function(window, document) {

  /** Cache used by various methods */
  var cache = {
    'counter': 0,
    'lastAction': 'load',
    'timers': { 'cleanup': null, 'load': null, 'post': null },
    'trash': createElement('div')
  },

  interpolate = Benchmark.interpolate;

  /*--------------------------------------------------------------------------*/

  /**
   * Registers an event listener.
   * @private
   * @param {Object} element The element.
   * @param {String} eventName The name of the event to listen to.
   * @param {Function} handler The event handler.
   */
  function addListener(element, eventName, handler) {
    if (typeof element.addEventListener != 'undefined') {
      element.addEventListener(eventName, handler, false);
    } else if (element.attachEvent != 'undefined') {
      element.attachEvent('on' + eventName, handler);
    }
  }

  /**
   * Shortcut for document.createElement().
   * @private
   * @param {String} tag The tag name of the element to create.
   * @returns {Object} A new of the given tag name element.
   */
  function createElement(tagName) {
    return document.createElement(tagName);
  }

  /**
   * Creates a Browserscope results object.
   * @private
   * @returns {Object|Null} Browserscope results object or null.
   */
  function createSnapshot() {
    // remove unrun, errored, or Infinity hz
    benches = Benchmark.filter(ui.benchmarks, function(bench) {
      return bench.cycles && isFinite(bench.hz);
    });

    // clone benchmarks using the upper limit of the confidence interval to compute hz
    benches = Benchmark.map(benches, function(bench) {
      var clone = bench.clone(),
          stats = bench.stats;

      clone.hz = Math.round(1 / (stats.mean + stats.ME));
      clone.id || (clone.id = Benchmark.indexOf(ui.benchmarks, bench) + 1);
      return clone;
    });

    return Benchmark.reduce(benches, function(result, bench, key) {
      key = (bench.name.match(/[a-z0-9]+/ig) || []).join(' ');<commit_msg>jsPerf: Fix leaked variable in Browserscope plugin. [jddalton]<commit_after>(function(window, document) {

  /** Cache used by various methods */
  var cache = {
    'counter': 0,
    'lastAction': 'load',
    'timers': { 'cleanup': null, 'load': null, 'post': null },
    'trash': createElement('div')
  },

  interpolate = Benchmark.interpolate;

  /*--------------------------------------------------------------------------*/

  /**
   * Registers an event listener.
   * @private
   * @param {Object} element The element.
   * @param {String} eventName The name of the event to listen to.
   * @param {Function} handler The event handler.
   */
  function addListener(element, eventName, handler) {
    if (typeof element.addEventListener != 'undefined') {
      element.addEventListener(eventName, handler, false);
    } else if (element.attachEvent != 'undefined') {
      element.attachEvent('on' + eventName, handler);
    }
  }

  /**
   * Shortcut for document.createElement().
   * @private
   * @param {String} tag The tag name of the element to create.
   * @returns {Object} A new of the given tag name element.
   */
  function createElement(tagName) {
    return document.createElement(tagName);
  }

  /**
   * Creates a Browserscope results object.
   * @private
   * @returns {Object|Null} Browserscope results object or null.
   */
  function createSnapshot() {
    // remove unrun, errored, or Infinity hz
    var benches = Benchmark.filter(ui.benchmarks, function(bench) {
      return bench.cycles && isFinite(bench.hz);
    });

    // clone benchmarks using the upper limit of the confidence interval to compute hz
    benches = Benchmark.map(benches, function(bench) {
      var clone = bench.clone(),
          stats = bench.stats;

      clone.hz = Math.round(1 / (stats.mean + stats.ME));
      clone.id || (clone.id = Benchmark.indexOf(ui.benchmarks, bench) + 1);
      return clone;
    });

    return Benchmark.reduce(benches, function(result, bench, key) {
      key = (bench.name.match(/[a-z0-9]+/ig) || []).join(' ');
{'fraction_non_alphanumeric': 0.17016029593094945, 'fraction_numerical': 0.002466091245376079, 'mean_word_length': 2.647482014388489, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3596242', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1182, 'n_words': 338}