<commit_before># frozen_string_literal: true

require "benchmark/memory"

def inherit_configurable(times)
  require "dry/configurable"

  klass = Class.new do
    extend Dry::Configurable

    setting :user, default: "jane"
    setting :pass, default: "<PASSWORD>"
  end

  times.times do
    _subclass = Class.new(klass)
  end
end

def inherit_configurable_nested(times)
  require "dry/configurable"

  klass = Class.new do
    extend Dry::Configurable

    setting :db do
      setting :user, default: "jane"
      setting :pass, default: "<PASSWORD>"
    end
  end

  times.times do
    _subclass = Class.new(klass)
  end
end

def inherit_dry_class_attributes(times)
  require "dry/core/class_attributes"

  klass = Class.new do
    extend Dry::Core::ClassAttributes

    defines :user, :pass

    user "jane"
    pass "<PASSWORD>"
  end

  times.times do
    _subclass = Class.new(klass)
  end
end

def inherit_hanami_class_attributes(times)
  require "hanami/utils/class_attribute"

  klass = Class.new do
    include Hanami::Utils::ClassAttribute

    class_attribute :user, :pass
<commit_msg>Move requires to top of benchmark<commit_after># frozen_string_literal: true

require "benchmark/memory"
require "dry/configurable"
require "dry/core/class_attributes"
require "hanami/utils/class_attribute"

def inherit_configurable(times)
  klass = Class.new do
    extend Dry::Configurable

    setting :user, default: "jane"
    setting :pass, default: "<PASSWORD>"
  end

  times.times do
    _subclass = Class.new(klass)
  end
end

def inherit_configurable_nested(times)
  klass = Class.new do
    extend Dry::Configurable

    setting :db do
      setting :user, default: "jane"
      setting :pass, default: "<PASSWORD>"
    end
  end

  times.times do
    _subclass = Class.new(klass)
  end
end

def inherit_dry_class_attributes(times)
  klass = Class.new do
    extend Dry::Core::ClassAttributes

    defines :user, :pass

    user "jane"
    pass "<PASSWORD>"
  end

  times.times do
    _subclass = Class.new(klass)
  end
end

def inherit_hanami_class_attributes(times)
  klass = Class.new do
    include Hanami::Utils::ClassAttribute

    class_attribute :user, :pass

{'fraction_non_alphanumeric': 0.09224414869206057, 'fraction_numerical': 0.0, 'mean_word_length': 3.64818763326226, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '7618199', 'n_tokens_mistral': 722, 'n_tokens_neox': 709, 'n_words': 187}