Sha256: c33905cd23c98be4a37cbdce254827ae35972a540db289a2b78b8264b0189135

Contents?: true

Size: 557 Bytes

Versions: 5

Compression:

Stored size: 557 Bytes

Contents

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

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

require 'fast_camelize'
require 'active_support/inflector'

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

  x.report('FastCamelize') do
    words.each { |word| FastCamelize.camelize(word) }
  end

  x.compare!
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fast_camelize-0.1.4 bin/bench
fast_camelize-0.1.3 bin/bench
fast_camelize-0.1.2 bin/bench
fast_camelize-0.1.1 bin/bench
fast_camelize-0.1.0 bin/bench