Sha256: ca3e317b42ff3fee0c738d7d40906636a287160cebc5058c603e4757d21378ce
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 KB
Contents
#!/usr/bin/env ruby $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__),'..','lib'))) require 'wordlist' require 'benchmark' require 'fileutils' path = File.expand_path(File.join(File.dirname(__FILE__),'shakespeare_wordlist.txt')) FileUtils.rm_f(path) Benchmark.bm do |bm| bm.report('build') do Wordlist::Builder.build(path) do |wordlist| wordlist.parse_file('/home/hal/shaks12.txt') end end bm.report('each_unique') do Wordlist::FlatFile.new(path) do |wordlist| wordlist.each_unique { |word| word } end end bm.report('each_mutation (1)') do Wordlist::FlatFile.new(path) do |wordlist| wordlist.mutate /o/i, '0' wordlist.each_mutation { |word| word } end end bm.report('each_mutation (2)') do Wordlist::FlatFile.new(path) do |wordlist| wordlist.mutate /o/i, '0' wordlist.mutate /a/i, '@' wordlist.each_mutation { |word| word } end end bm.report('each_mutation (3)') do Wordlist::FlatFile.new(path) do |wordlist| wordlist.mutate /o/i, '0' wordlist.mutate /a/i, '@' wordlist.mutate /e/i, '3' wordlist.each_mutation { |word| word } end end end Benchmark.bm do |bm| mutator = Wordlist::Mutator.new(/o/i, '0') bm.report('Mutator#each') do mutator.each('lololololoLOLOLOLOLO') { |word| } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wordlist-0.1.1 | scripts/benchmark |