Sha256: f9940cf4bfe95ffa3f21fc59e0d47cc356759fca69bc9e0bc344516ff552f52e

Contents?: true

Size: 524 Bytes

Versions: 3

Compression:

Stored size: 524 Bytes

Contents

#!/usr/bin/env ruby

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

require 'active_support'
require 'fast_underscore'

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.underscore(word) }
  end

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

  x.compare!
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fast_underscore-0.0.3 bin/benchmark
fast_underscore-0.0.2 bin/benchmark
fast_underscore-0.0.1 bin/benchmark