Skip to content

Commit

Permalink
benchmark for lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
jrochkind committed Mar 8, 2013
1 parent 625bc2d commit 896c8e2
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/benchmark_lookup.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env ruby

require "benchmark"
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
require 'language_list'


count = LanguageList::ALL_LANGUAGES.count

time = Benchmark.measure do


1000.times do
target = LanguageList::ALL_LANGUAGES[rand(count)]

LanguageList::LanguageInfo.find_by_name(target.name)
LanguageList::LanguageInfo.find(target.iso_639_3)
end
end
puts time

0 comments on commit 896c8e2

Please sign in to comment.