<commit_before>'use babel'

import {MessageRegistry} from '../lib/message-registry'
import {getLinter, getMessage} from '../spec/common'
import {timeNow, timeDiff, getMessages} from './common'

const messageRegistry = new MessageRegistry()
messageRegistry.debouncedUpdate = function() {}
const linter = getLinter()

function benchmarkRegistry(i) {
  let timeKey = 'iteration #' + i
  messages = getMessages(5000)
  console.time(timeKey)
  messageRegistry.set({linter, messages, buffer: null})
  messageRegistry.update()
  console.timeEnd(timeKey)
}
module.exports = function() {
  for (let i = 0; i < 50; ++i) {
    benchmarkRegistry(i)
  }
}<commit_msg>art: Count average in benchmark<commit_after>'use babel'

import {MessageRegistry} from '../lib/message-registry'
import {getLinter, getMessage} from '../spec/common'
import {timeNow, timeDiff, getMessages} from './common'

const messageRegistry = new MessageRegistry()
messageRegistry.debouncedUpdate = function() {}
const linter = getLinter()

function benchmarkRegistry(i) {
  let timeKey = 'iteration #' + i
  messages = getMessages(5000)
  const start = performance.now()
  messageRegistry.set({linter, messages, buffer: null})
  messageRegistry.update()
  return performance.now() - start
}
module.exports = function() {
  let sum = 0
  let count = 500
  for (let i = 0; i < count; ++i) {
    sum += benchmarkRegistry(i)
  }
  console.log('average', sum / (count - 1))
}
{'fraction_non_alphanumeric': 0.13776223776223775, 'fraction_numerical': 0.011888111888111888, 'mean_word_length': 4.701195219123506, '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': '5806317', 'n_tokens_mistral': 459, 'n_tokens_neox': 435, 'n_words': 121}