<commit_before>'use strict';

require('../test/browser');

if (!process.browser) {
  window.getSelection = function () {
    return {
      getRangeAt: function () {
        return {};
      },
      removeAllRanges: function () {},
      addRange: function () {}
    };
  };

  document.createRange = function () {};
}

var update = require('../');
var fs = require('fs');
var text = document.createElement('div');
text.innerHTML = fs.readFileSync(__dirname + '/text.html', 'utf8');

var start = Date.now();
var count = 0;
var duration;

for (count = 0; count < 1000; ++count) {
  update(text);
}
duration = Date.now() - start;

console.log((duration / count) + ' ms / iteration');<commit_msg>browser-benchmark - but msg in body<commit_after>'use strict';

require('../test/browser');

if (!process.browser) {
  window.getSelection = function () {
    return {
      getRangeAt: function () {
        return {};
      },
      removeAllRanges: function () {},
      addRange: function () {}
    };
  };

  document.createRange = function () {};
}

var update = require('../');
var fs = require('fs');
var text = document.createElement('div');
text.innerHTML = fs.readFileSync(__dirname + '/text.html', 'utf8');

var start = Date.now();
var count = 0;
var duration;

for (count = 0; count < 1000; ++count) {
  update(text);
}
duration = Date.now() - start;

var msg = (duration / count) + ' ms / iteration';
console.log(msg);
document.body.appendChild(document.createTextNode(msg));
{'fraction_non_alphanumeric': 0.1862348178137652, 'fraction_numerical': 0.009446693657219974, 'mean_word_length': 3.3362573099415203, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3062042', 'n_tokens_mistral': 471, 'n_tokens_neox': 456, 'n_words': 111}