Skip to content

Commit

Permalink
First pass at a benchmarking script.
Browse files Browse the repository at this point in the history
  • Loading branch information
chanks committed Jul 11, 2014
1 parent d0086a2 commit bd34275
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions benchmark/process_items.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ class ItemRecommender

flush!

items = (1..20).map { |i| "item-#{i}" }
users = (1..10).map { |i| "user-#{i}" }
parts = (1..10).map { |i| "part-#{i}" }
items = (1..100).map { |i| "item-#{i}" }
users = (1..50).map { |i| "user-#{i}" }
parts = (1..50).map { |i| "part-#{i}" }

r = ItemRecommender.new

start = Time.now
users.each { |user| r.users.add_to_set user, *items.sample(5) }
parts.each { |part| r.parts.add_to_set part, *items.sample(5) }
users.each { |user| r.users.add_to_set user, *items.sample(20) }
parts.each { |part| r.parts.add_to_set part, *items.sample(20) }
elapsed = Time.now - start

puts "add_to_set = #{elapsed.round(3)} seconds"
Expand Down

0 comments on commit bd34275

Please sign in to comment.