lib/fuzzy_realty.rb in rkneufeld-fuzzy-realty-0.6.2 vs lib/fuzzy_realty.rb in rkneufeld-fuzzy-realty-0.7.0
- old
+ new
@@ -26,29 +26,9 @@
end
scores << { :score => score, :listing => listing}
end
return scores.sort {|a,b| b[:score] <=> a[:score]}
end
- def self.performance
- puts "Benchmarking search through 100,000-1 (powers of ten) random listings"
- puts "======================================================================="
- listings = []
- 100_000.times { listings << Listing.random }
- puts "Generated #{listings.count} random listings"
- Benchmark.bm do |x|
- x.report("100,000 listings:") { ExpertSystem.scores(listings,Query.random) }
- listings = listings[(0...10_000)]
- x.report("10,000 listings:") { ExpertSystem.scores(listings,Query.random) }
- listings = listings[(0...1_000)]
- x.report("1,000 listings:") { ExpertSystem.scores(listings,Query.random) }
- listings = listings[(0...100)]
- x.report("100 listings:") { ExpertSystem.scores(listings,Query.random) }
- listings = listings[(0...10)]
- x.report("10 listings:") { ExpertSystem.scores(listings,Query.random) }
- listings = listings[(0...1)]
- x.report("1 listing:") { ExpertSystem.scores(listings,Query.random) }
- end
- end
end
end
#When running the library directly calculate an example
if __FILE__ == $0
\ No newline at end of file