Sha256: 8f040e9d29c5d3c776c648b7b1182a5227fe2b5c3336a5572fc5c431be87b047

Contents?: true

Size: 524 Bytes

Versions: 1

Compression:

Stored size: 524 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.underscore(word) }
  end

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

  x.compare!
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fast_underscore-0.1.0 bin/benchmark