<commit_before>#!/usr/bin/env ruby

require 'digest'
require 'optparse'
require 'shellwords'

opt = { pattern: [] }

OptionParser.new{|o|
  o.on('-e', '--executables [EXEC]', "Specify benchmark target (e1::path1)"){|e|
    opt[:exec] = e # discard...
  }
  o.on('-p', '--pattern <PATTERN1,PATTERN2,PATTERN3>', "Benchmark name pattern"){|p|
    opt[:pattern] = p.split(',')
  }
  o.on('--with-jit', "Run benchmarks once with JIT enabled and once without"){
    opt[:jit] = true
  }
  o.on('-r', '--repeat-count [NUM]', "Repeat count"){|n|
    opt[:repeat] = n.to_i
  }
  o.on('-o', '--output-file [FILE]', "Output file"){|f|
    opt[:output] = f # discard...
  }
}.parse!(ARGV)

filter = opt.fetch(:pattern).map { |p| ['--filter', p] }.flatten

benchmark_dir = File.expand_path('./benchmark', __dir__)
benchmarks = Dir.glob("#{benchmark_dir}/*.rb") + Dir.glob("#{benchmark_dir}/*.yml")

benchmarks.each do |benchmark|<commit_msg>Execute benchmarks in alphabetical order<commit_after>#!/usr/bin/env ruby

require 'digest'
require 'optparse'
require 'shellwords'

opt = { pattern: [] }

OptionParser.new{|o|
  o.on('-e', '--executables [EXEC]', "Specify benchmark target (e1::path1)"){|e|
    opt[:exec] = e # discard...
  }
  o.on('-p', '--pattern <PATTERN1,PATTERN2,PATTERN3>', "Benchmark name pattern"){|p|
    opt[:pattern] = p.split(',')
  }
  o.on('--with-jit', "Run benchmarks once with JIT enabled and once without"){
    opt[:jit] = true
  }
  o.on('-r', '--repeat-count [NUM]', "Repeat count"){|n|
    opt[:repeat] = n.to_i
  }
  o.on('-o', '--output-file [FILE]', "Output file"){|f|
    opt[:output] = f # discard...
  }
}.parse!(ARGV)

filter = opt.fetch(:pattern).map { |p| ['--filter', p] }.flatten

benchmark_dir = File.expand_path('./benchmark', __dir__)
benchmarks = Dir.glob("#{benchmark_dir}/*.rb") + Dir.glob("#{benchmark_dir}/*.yml")

benchmarks.sort.each do |benchmark|
{'fraction_non_alphanumeric': 0.23252118644067796, 'fraction_numerical': 0.005296610169491525, 'mean_word_length': 3.945026178010471, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2076100', 'n_tokens_mistral': 766, 'n_tokens_neox': 732, 'n_words': 147}