<commit_before>/*!
 * benchmark.js
 * Copyright <NAME> <http://mths.be/>
 * Based on JSLitmus.js, copyright <NAME> <http://broofa.com/>
 * Modified by <NAME> <http://allyoucanleet.com/>
 * Available under MIT license <http://mths.be/mit>
 */

(function(global) {

  /** MAX_RUN_COUNT divisors used to avoid hz of Infinity */
  var CYCLE_DIVISORS = { '1': 32, '2': 16, '3': 8, '4': 4, '5': 2, '6': 1 };

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

 /**
  * Benchmark constructor.
  * @constructor
  * @param {Function} fn Test to benchmark.
  * @param {Object} [options={}] Options object.
  */
  function Benchmark(fn, options) {
    options = extend({ }, options);
    extend(this, options);
    this.fn = fn;
    this.options = options;
    this.times = { };
  }

 /**
  * Subclass of Benchmark used specifically for calibration.
  * @private
  * @constructor
  * @base Benchmark
  * @param {Function} fn Test to benchmark.
  * @param {Object} [options={}] Options object.
  */
  function Calibration(fn, options) {
    Benchmark.call(this, fn, options);
  }

  (function() {

   /**
    * Runs calibration benchmarks without calibrating itself.
    * @member Calibration
    * @param {Number} [count=Benchmark#INIT_RUN_COUNT] Iterations to clock on first cycle.
    * @param {Boolean} [async=false] Flag to run asynchronously.
    */
    function run(count, async) {
      var me = this;
      me.reset();
      me.count = count || me.INIT_RUN_COUNT;
      me.running = true;
      me.times.start = +new Date;
      me.onStart(me);
      _run(me, async == null ? me.DEFAULT_ASYNC : async);
    }

    // Calibration inherits from Benchmark
    function Klass() { }
    Klass.prototype = Benchmark.prototype;
    var proto = Calibration.prototype = new Klass;

    // point to the correct constructor
    proto.constructor = Calibration;
    // custom run method to avoid calibrating itself
    proto.run = run;
  }());

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

 /**
  * Checks if calibrations have completed and, if not, fires a callback when completed.
  * @private
  * @param {Function} callback Function executed after calibration.
  * @param {Boolean} [async=false] Flag to run asynchronously.
  * @returns {Boolean} Returns true if calibrated, false if not.
  */
  function isCalibrated(callback, async) {
    var cals = Benchmark.CALIBRATIONS,
        result = !filter(cals, function(cal) { return !cal.cycles; }).length;
    // calibrate all if one has not ran
    if (!result) {
      invoke(cals, {
        'async': async,
        'methodName': 'run',
        'onComplete': callback
      });
    }
    return result;
  }

 /**
  * Executes a function asynchronously or synchronously.
  * @private
  * @param {Object} me The benchmark instance passed to `fn`.
  * @param {Function} fn Function to be executed.
  * @param {Boolean} [async=false] Flag to run asynchronously.
  */
  function call(me, fn, async) {
    async && typeof global.setTimeout == 'function'
      ? setTimeout(function() { fn(me, async); }, me.CYCLE_DELAY * 1e3)<commit_msg>benchmark: Correct host object setTimeout detection for IE. [jddalton]<commit_after>/*!
 * benchmark.js
 * Copyright <NAME> <http://mths.be/>
 * Based on JSLitmus.js, copyright <NAME> <http://broofa.com/>
 * Modified by <NAME> <http://allyoucanleet.com/>
 * Available under MIT license <http://mths.be/mit>
 */

(function(global) {

  /** MAX_RUN_COUNT divisors used to avoid hz of Infinity */
  var CYCLE_DIVISORS = { '1': 32, '2': 16, '3': 8, '4': 4, '5': 2, '6': 1 };

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

 /**
  * Benchmark constructor.
  * @constructor
  * @param {Function} fn Test to benchmark.
  * @param {Object} [options={}] Options object.
  */
  function Benchmark(fn, options) {
    options = extend({ }, options);
    extend(this, options);
    this.fn = fn;
    this.options = options;
    this.times = { };
  }

 /**
  * Subclass of Benchmark used specifically for calibration.
  * @private
  * @constructor
  * @base Benchmark
  * @param {Function} fn Test to benchmark.
  * @param {Object} [options={}] Options object.
  */
  function Calibration(fn, options) {
    Benchmark.call(this, fn, options);
  }

  (function() {

   /**
    * Runs calibration benchmarks without calibrating itself.
    * @member Calibration
    * @param {Number} [count=Benchmark#INIT_RUN_COUNT] Iterations to clock on first cycle.
    * @param {Boolean} [async=false] Flag to run asynchronously.
    */
    function run(count, async) {
      var me = this;
      me.reset();
      me.count = count || me.INIT_RUN_COUNT;
      me.running = true;
      me.times.start = +new Date;
      me.onStart(me);
      _run(me, async == null ? me.DEFAULT_ASYNC : async);
    }

    // Calibration inherits from Benchmark
    function Klass() { }
    Klass.prototype = Benchmark.prototype;
    var proto = Calibration.prototype = new Klass;

    // point to the correct constructor
    proto.constructor = Calibration;
    // custom run method to avoid calibrating itself
    proto.run = run;
  }());

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

 /**
  * Checks if calibrations have completed and, if not, fires a callback when completed.
  * @private
  * @param {Function} callback Function executed after calibration.
  * @param {Boolean} [async=false] Flag to run asynchronously.
  * @returns {Boolean} Returns true if calibrated, false if not.
  */
  function isCalibrated(callback, async) {
    var cals = Benchmark.CALIBRATIONS,
        result = !filter(cals, function(cal) { return !cal.cycles; }).length;
    // calibrate all if one has not ran
    if (!result) {
      invoke(cals, {
        'async': async,
        'methodName': 'run',
        'onComplete': callback
      });
    }
    return result;
  }

 /**
  * Executes a function asynchronously or synchronously.
  * @private
  * @param {Object} me The benchmark instance passed to `fn`.
  * @param {Function} fn Function to be executed.
  * @param {Boolean} [async=false] Flag to run asynchronously.
  */
  function call(me, fn, async) {
    async && !/^(boolean|number|string|undefined)$/.test(typeof global.setTimeout)
      ? setTimeout(function() { fn(me, async); }, me.CYCLE_DELAY * 1e3)
{'fraction_non_alphanumeric': 0.1790317510216913, 'fraction_numerical': 0.005029864822382898, 'mean_word_length': 2.475150191152376, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '6456555', 'n_tokens_mistral': 1995, 'n_tokens_neox': 1890, 'n_words': 572}