Sha256: 8d454cc986bb0057662f7de28a92d893b2fff81f35b77f325595951f0b8def86

Contents?: true

Size: 557 Bytes

Versions: 2

Compression:

Stored size: 557 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'bundler/setup'
require 'benchmark/ips'

require 'fast_underscore'
require 'active_support'

source =
  %w[_ - : :: / 漢字 😊🎉] + ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a
words = 500.times.map { Array.new(100) { source.sample }.join }

Benchmark.ips do |x|
  x.report('ActiveSupport') do
    words.each { |word| ActiveSupport::Inflector.as_underscore(word) }
  end

  x.report('FastUnderscore') do
    words.each { |word| FastUnderscore.underscore(word) }
  end

  x.compare!
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fast_underscore-0.3.3 bin/bench
fast_underscore-0.3.2 bin/bench