<commit_before>(function(window) {

  /** Use a single "load" function */
  var load = typeof require == 'function' ? require : window.load;

  /** The file path of the Lo-Dash file to test */
  var filePath = (function() {
    var min = 0;
    var result = window.phantom
      ? phantom.args
      : (window.system
          ? (min = 1, system.args)
          : (window.process ? (min = 2, process.argv) : (window.arguments || []))
        );

    var last = result[result.length - 1];
    result = (result.length > min && !/perf(?:\.js)?$/.test(last))
      ? last
      : '../lodash.js';

    try {
      result = require('fs').realpathSync(result);
    } catch(e) { }

    return result;
  }());

  /** Load Lo-Dash */
  var lodash = window.lodash || (window.lodash = (
    lodash = load(filePath) || window._,
    lodash = lodash._ || lodash,
    lodash.noConflict()
  ));

  /** Load Benchmark.js */
  var Benchmark = window.Benchmark || (window.Benchmark = (
    Benchmark = load('../vendor/benchmark.js/benchmark.js') || window.Benchmark,
    Benchmark = Benchmark.Benchmark || Benchmark,
    Benchmark.runInContext(lodash.extend({}, window, { '_': lodash }))
  ));

  /** Load Underscore */
  var _ = window._ || (window._ = (
    _ = load('../vendor/underscore/underscore.js') || window._,
    _._ || _
  ));

  /** Used to access the Firebug Lite panel (set by `run`) */
  var fbPanel;

  /** Used to match path separators */
  var rePathSeparator = /[\/\\]/;

  /** Used to detect primitive types */
  var rePrimitive = /^(?:boolean|number|string|undefined)$/;

  /** Used to match RegExp special characters */
  var reSpecialChars = /[.*+?^=!:${}()|[\]\/\\]/g;

  /** Used to score performance */
  var score = { 'a': 0, 'b': 0 };

  /** Used to queue benchmark suites */
  var suites = [];

  /** Used to resolve a value's internal [[Class]] */
  var toString = Object.prototype.toString;

  /** The `ui` object */
  var ui = window.ui || ({
    'buildPath': basename(filePath, '.js'),
    'otherPath': 'underscore'
  });

  /** The Lo-Dash build basename */
  var buildName = basename(ui.buildPath, '.js');

  /** The other library basename */
  var otherName = basename(ui.otherPath, '.js');

  /** Detect if in a browser environment */
  var isBrowser = isHostType(window, 'document') && isHostType(window, 'navigator');

  /** Detect Java environment */
  var isJava = !isBrowser && /Java/.test(toString.call(window.java));

  /** Add `console.log()` support for Narwhal, Rhino, and RingoJS */
  var console = window.console || (window.console = { 'log': window.print });

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

  /**
   * Gets the basename of the given `filePath`. If the file `extension` is passed,
   * it will be removed from the basename.
   *
   * @private
   * @param {String} path The file path to inspect.
   * @param {String} extension The extension to remove.
   * @returns {String} Returns the basename.
   */
  function basename(filePath, extension) {
    var result = (filePath || '').split(rePathSeparator).pop();
    return (arguments.length < 2)
      ? result
      : result.replace(RegExp(extension.replace(reSpecialChars, '\\$&') + '$'), '');
  }

  /**
   * Gets the Hz, i.e. operations per second, of `bench` adjusted for the
   * margin of error.
   *
   * @private
   * @param {Object} bench The benchmark object.
   * @returns {Number} Returns the adjusted Hz.
   */
  function getHz(bench) {
    var result = 1 / (bench.stats.mean + bench.stats.moe);
    return isFinite(result) ? result : 0;
  }

  /**
   * Host objects can return type values that are different from their actual
   * data type. The objects we are concerned with usually return non-primitive
   * types of "object", "function", or "unknown".
   *
   * @private
   * @param {Mixed} object The owner of the property.
   * @param {String} property The property to check.
   * @returns {Boolean} Returns `true` if the property value is a non-primitive, else `false`.
   */
  function isHostType(object, property) {
    if (object == null) {
      return false;
    }
    var type = typeof object[property];
    return !rePrimitive.test(type) && (type != 'object' || !!object[property]);
  }

  /**
   * Logs text to the console.
   *
   * @private
   * @param {String} text The text to log.
   */
  function log(text) {
    console.log(text + '');
    if (fbPanel) {
      // scroll the Firebug Lite panel down
      fbPanel.scrollTop = fbPanel.scrollHeight;
    }
  }

  /**
   * Runs all benchmark suites.
   *
   * @private (@public in the browser)
   */
  function run() {
    fbPanel = (fbPanel = window.document && document.getElementById('FirebugUI')) &&
      (fbPanel = (fbPanel = fbPanel.contentWindow || fbPanel.contentDocument).document || fbPanel) &&
      fbPanel.getElementById('fbPanel1');

    log('\nSit back and relax, this may take a while.');
    suites[0].run({ 'async': !isJava });
  }

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

  lodash.extend(Benchmark.Suite.options, {
    'onStart': function() {
      log('\n' + this.name + ':');
    },
    'onCycle': function(event) {
      log(event.target);
    },
    'onComplete': function() {
      var formatNumber = Benchmark.formatNumber,
          fastest = this.filter('fastest'),
          fastestHz = getHz(fastest[0]),
          slowest = this.filter('slowest'),
          slowestHz = getHz(slowest[0]),
          aHz = getHz(this[0]),
          bHz = getHz(this[1]);

      if (fastest.length > 1) {
        log('It\'s too close to call.');
        aHz = bHz = slowestHz;
      }
      else {
        var percent = ((fastestHz / slowestHz) - 1) * 100;

        log(
          fastest[0].name + ' is ' +
          formatNumber(percent < 1 ? percent.toFixed(2) : Math.round(percent)) +
          '% faster.'
        );
      }
      // add score adjusted for margin of error
      score.a += aHz;
      score.b += bHz;

      // remove current suite from queue
      suites.shift();

      if (suites.length) {
        // run next suite
        suites[0].run({ 'async': !isJava });<commit_msg>Don't include tests that error in the total score of the perf.js suite. [ci skip]<commit_after>(function(window) {

  /** Use a single "load" function */
  var load = typeof require == 'function' ? require : window.load;

  /** The file path of the Lo-Dash file to test */
  var filePath = (function() {
    var min = 0;
    var result = window.phantom
      ? phantom.args
      : (window.system
          ? (min = 1, system.args)
          : (window.process ? (min = 2, process.argv) : (window.arguments || []))
        );

    var last = result[result.length - 1];
    result = (result.length > min && !/perf(?:\.js)?$/.test(last))
      ? last
      : '../lodash.js';

    try {
      result = require('fs').realpathSync(result);
    } catch(e) { }

    return result;
  }());

  /** Load Lo-Dash */
  var lodash = window.lodash || (window.lodash = (
    lodash = load(filePath) || window._,
    lodash = lodash._ || lodash,
    lodash.noConflict()
  ));

  /** Load Benchmark.js */
  var Benchmark = window.Benchmark || (window.Benchmark = (
    Benchmark = load('../vendor/benchmark.js/benchmark.js') || window.Benchmark,
    Benchmark = Benchmark.Benchmark || Benchmark,
    Benchmark.runInContext(lodash.extend({}, window, { '_': lodash }))
  ));

  /** Load Underscore */
  var _ = window._ || (window._ = (
    _ = load('../vendor/underscore/underscore.js') || window._,
    _._ || _
  ));

  /** Used to access the Firebug Lite panel (set by `run`) */
  var fbPanel;

  /** Used to match path separators */
  var rePathSeparator = /[\/\\]/;

  /** Used to detect primitive types */
  var rePrimitive = /^(?:boolean|number|string|undefined)$/;

  /** Used to match RegExp special characters */
  var reSpecialChars = /[.*+?^=!:${}()|[\]\/\\]/g;

  /** Used to score performance */
  var score = { 'a': 0, 'b': 0 };

  /** Used to queue benchmark suites */
  var suites = [];

  /** Used to resolve a value's internal [[Class]] */
  var toString = Object.prototype.toString;

  /** The `ui` object */
  var ui = window.ui || ({
    'buildPath': basename(filePath, '.js'),
    'otherPath': 'underscore'
  });

  /** The Lo-Dash build basename */
  var buildName = basename(ui.buildPath, '.js');

  /** The other library basename */
  var otherName = basename(ui.otherPath, '.js');

  /** Detect if in a browser environment */
  var isBrowser = isHostType(window, 'document') && isHostType(window, 'navigator');

  /** Detect Java environment */
  var isJava = !isBrowser && /Java/.test(toString.call(window.java));

  /** Add `console.log()` support for Narwhal, Rhino, and RingoJS */
  var console = window.console || (window.console = { 'log': window.print });

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

  /**
   * Gets the basename of the given `filePath`. If the file `extension` is passed,
   * it will be removed from the basename.
   *
   * @private
   * @param {String} path The file path to inspect.
   * @param {String} extension The extension to remove.
   * @returns {String} Returns the basename.
   */
  function basename(filePath, extension) {
    var result = (filePath || '').split(rePathSeparator).pop();
    return (arguments.length < 2)
      ? result
      : result.replace(RegExp(extension.replace(reSpecialChars, '\\$&') + '$'), '');
  }

  /**
   * Gets the Hz, i.e. operations per second, of `bench` adjusted for the
   * margin of error.
   *
   * @private
   * @param {Object} bench The benchmark object.
   * @returns {Number} Returns the adjusted Hz.
   */
  function getHz(bench) {
    var result = 1 / (bench.stats.mean + bench.stats.moe);
    return isFinite(result) ? result : 0;
  }

  /**
   * Host objects can return type values that are different from their actual
   * data type. The objects we are concerned with usually return non-primitive
   * types of "object", "function", or "unknown".
   *
   * @private
   * @param {Mixed} object The owner of the property.
   * @param {String} property The property to check.
   * @returns {Boolean} Returns `true` if the property value is a non-primitive, else `false`.
   */
  function isHostType(object, property) {
    if (object == null) {
      return false;
    }
    var type = typeof object[property];
    return !rePrimitive.test(type) && (type != 'object' || !!object[property]);
  }

  /**
   * Logs text to the console.
   *
   * @private
   * @param {String} text The text to log.
   */
  function log(text) {
    console.log(text + '');
    if (fbPanel) {
      // scroll the Firebug Lite panel down
      fbPanel.scrollTop = fbPanel.scrollHeight;
    }
  }

  /**
   * Runs all benchmark suites.
   *
   * @private (@public in the browser)
   */
  function run() {
    fbPanel = (fbPanel = window.document && document.getElementById('FirebugUI')) &&
      (fbPanel = (fbPanel = fbPanel.contentWindow || fbPanel.contentDocument).document || fbPanel) &&
      fbPanel.getElementById('fbPanel1');

    log('\nSit back and relax, this may take a while.');
    suites[0].run({ 'async': !isJava });
  }

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

  lodash.extend(Benchmark.Suite.options, {
    'onStart': function() {
      log('\n' + this.name + ':');
    },
    'onCycle': function(event) {
      log(event.target);
    },
    'onComplete': function() {
      var formatNumber = Benchmark.formatNumber,
          fastest = this.filter('fastest'),
          fastestHz = getHz(fastest[0]),
          slowest = this.filter('slowest'),
          slowestHz = getHz(slowest[0]),
          aHz = getHz(this[0]),
          bHz = getHz(this[1]);

      for (var index = 0, length = this.length; index < length; index++) {
        var bench = this[index];
        if (bench.error) {
          var errored = true;
          log(bench.error);
        }
      }
      if (!errored) {
        if (fastest.length > 1) {
          log('It\'s too close to call.');
          aHz = bHz = slowestHz;
        }
        else {
          var percent = ((fastestHz / slowestHz) - 1) * 100;

          log(
            fastest[0].name + ' is ' +
            formatNumber(percent < 1 ? percent.toFixed(2) : Math.round(percent)) +
            '% faster.'
          );
        }
        // add score adjusted for margin of error
        score.a += aHz;
        score.b += bHz;
      }
      // remove current suite from queue
      suites.shift();

      if (suites.length) {
        // run next suite
        suites[0].run({ 'async': !isJava });
{'fraction_non_alphanumeric': 0.18072669826224327, 'fraction_numerical': 0.0038704581358609794, 'mean_word_length': 2.285158277114686, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 7, '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': '7606678', 'n_tokens_mistral': 4038, 'n_tokens_neox': 3884, 'n_words': 1068}