<commit_before>if ENV['LOAD_PROFILE']
  # Must be loaded before we use Time.now.
  require 'timecop'

  puts "profiling enabled."
  module Kernel
    SLOW = (ENV['SLOW'] && ENV['SLOW'].to_f) || 0.05

    [ :require, :load ].each do |method|
      alias_method "old_#{method}", method

      define_method(method) do |*opts|
        start_time = Time.now
        ret = send("old_#{method}", *opts)
        elapsed_time = Time.now - start_time

        if elapsed_time > SLOW
          puts "Slow #{method}: #{opts.first} #{(elapsed_time * 1000.0).to_i} ms"
        end

        ret
      end
    end
  end
end
<commit_msg>Attempt to fix bad score in code climate.<commit_after>if ENV['LOAD_PROFILE']
  SLOW = (ENV['SLOW'] && ENV['SLOW'].to_f) || 0.05

  puts "profiling enabled."
  module Kernel
    def self.define_profiling_method(method)
      alias_method "old_#{method}", method

      define_method(method) do |*opts|
        start_time = Time.now
        ret = send("old_#{method}", *opts)
        elapsed_time = Time.now - start_time

        if elapsed_time > SLOW
          puts "Slow #{method}: #{opts.first} #{(elapsed_time * 1000.0).to_i} ms"
        end

        ret
      end
    end

    [ :require, :load ].each do |method|
      define_profiling_method(method)
    end
  end
end

{'fraction_non_alphanumeric': 0.13194444444444445, 'fraction_numerical': 0.012345679012345678, 'mean_word_length': 2.486559139784946, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3194424', 'n_tokens_mistral': 467, 'n_tokens_neox': 443, 'n_words': 112}