Sha256: f9de73550997abbeec20bf0997f790b891b98196dc3c6105c73b93821955b50f

Contents?: true

Size: 283 Bytes

Versions: 14

Compression:

Stored size: 283 Bytes

Contents

require_relative './shared'

str = 'Lorem ipsum et dolorem'
tr = '^A-Za-z'
cs = CharacterSet.non_ascii_letter

benchmark(
  caption: 'Counting non-letters',
  cases: {
    'String#count'          => -> { str.count(tr) },
    'CharacterSet#count_in' => -> { cs.count_in(str) },
  }
)

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
character_set-1.8.0-java tasks/benchmarks/count_in.rb
character_set-1.8.0 tasks/benchmarks/count_in.rb
character_set-1.7.0-java tasks/benchmarks/count_in.rb
character_set-1.7.0 tasks/benchmarks/count_in.rb
character_set-1.6.0-java benchmarks/count_in.rb
character_set-1.6.0 benchmarks/count_in.rb
character_set-1.5.0-java benchmarks/count_in.rb
character_set-1.5.0 benchmarks/count_in.rb
character_set-1.4.1-java benchmarks/count_in.rb
character_set-1.4.1 benchmarks/count_in.rb
character_set-1.4.0-java benchmarks/count_in.rb
character_set-1.4.0 benchmarks/count_in.rb
character_set-1.3.0-java benchmarks/count_in.rb
character_set-1.3.0 benchmarks/count_in.rb