Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
chanks committed Jul 19, 2014
1 parent 2f3d714 commit 6b9a032
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions benchmark/process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ class ItemRecommender

flush!

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

r = ItemRecommender.new

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

puts "add_to_set = #{elapsed.round(3)} seconds"
Expand Down
4 changes: 2 additions & 2 deletions lib/predictor/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ def process_items!(*items)
matrix_json = JSON.dump(matrix_data)

items.each do |item|
Predictor.process_lua_script(redis_key, matrix_json, similarity_limit, item)
# Predictor.process_lua_script(redis_key, matrix_json, similarity_limit, item)

# related_items(item).each{ |related_item| cache_similarity(item, related_item) }
related_items(item).each{ |related_item| cache_similarity(item, related_item) }
end

return self
Expand Down

0 comments on commit 6b9a032

Please sign in to comment.