Permalink
Browse files

added warmed up jruby benchmarks

  • Loading branch information...
1 parent f2a4429 commit 640913d1f2344f6676909f9afe31763ae3ca76e4 @mattetti committed Jan 10, 2009
Showing with 26 additions and 1 deletion.
  1. +2 −1 README.markdown
  2. +24 −0 script/jruby-benchmarks.rb
View
@@ -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
View
@@ -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.