Sha256: a284c354453b83d41d5936c086cabd445bbf8f22298896d1b55b5a6270339167

Contents?: true

Size: 527 Bytes

Versions: 3

Compression:

Stored size: 527 Bytes

Contents

#!/usr/bin/env ruby

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

3 entries across 3 versions & 1 rubygems

Version Path
fast_underscore-0.3.1 bin/benchmark
fast_underscore-0.3.0 bin/benchmark
fast_underscore-0.2.0 bin/benchmark