Skip to content

Commit

Permalink
added warmed up jruby benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
mattetti committed Jan 10, 2009
1 parent f2a4429 commit 640913d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ By default, only the 4 top results get retrieved, you can specify the exact amou
## Experimentations

Here are some benchmarks, it looks like running multiple concurrent threads is often not worth it
http://gist.github.com/45350
http://gist.github.com/45350
warmed up jruby benchmarks
24 changes: 24 additions & 0 deletions script/jruby-benchmarks.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# For better performance, you have to warm up JRuby

require 'benchmark'
require File.join(File.dirname(__FILE__), '..', 'lib', 'ruby-web-search')

10.times do
n = 50000
Benchmark.bm(50) do |x|
x.report("search") { RubyWebSearch::Google.search(:query => "Natalie Portman") }
x.report("unthreaded_search") { RubyWebSearch::Google.unthreaded_search(:query => 'Natalie Portman') }

x.report("search :size => 30") { RubyWebSearch::Google.search(:query => "Natalie Portman", :size => 30) }
x.report("unthreaded_search :size => 30") { RubyWebSearch::Google.unthreaded_search(:query => 'Natalie Portman', :size => 30) }

x.report("search :size => 80") { RubyWebSearch::Google.search(:query => "Natalie Portman", :size => 80) }
x.report("unthreaded_search :size => 80") { RubyWebSearch::Google.unthreaded_search(:query => 'Natalie Portman', :size => 80) }

x.report("search :size => 150") { RubyWebSearch::Google.search(:query => "Natalie Portman", :size => 150) }
x.report("unthreaded_search :size => 150") { RubyWebSearch::Google.unthreaded_search(:query => 'Natalie Portman', :size => 150) }

x.report("search :size => 200") { RubyWebSearch::Google.search(:query => "Natalie Portman", :size => 200) }
x.report("unthreaded_search :size => 200") { RubyWebSearch::Google.unthreaded_search(:query => 'Natalie Portman', :size => 200) }
end
end

0 comments on commit 640913d

Please sign in to comment.