Sha256: 299511a5f333ff4bc373d35314e57f0ce8933d16285f8441f77ad661489f2d48

Contents?: true

Size: 577 Bytes

Versions: 3

Compression:

Stored size: 577 Bytes

Contents

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

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

require 'fast_parameterize'
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_parameterize(word) }
  end

  x.report('FastParameterize') do
    words.each { |word| FastParameterize.parameterize(word) }
  end

  x.compare!
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fast_parameterize-0.1.2 bin/bench
fast_parameterize-0.1.1 bin/bench
fast_parameterize-0.1.0 bin/bench