Sha256: 5cb762545cc01667ce2d219992eced084818142cd37566f72a073b83a643801a
Contents?: true
Size: 1.46 KB
Versions: 2
Compression:
Stored size: 1.46 KB
Contents
require 'rubygems' require 'ruby-prof' require 'fuzzy_realty.rb' RubyProf.start puts "Generating 10000 Listings" listings = [] 10000.times do |i| listings << FuzzyRealty::Listing.random end query = FuzzyRealty::Query.new query << FuzzyRealty::Parameter.new(:price,250000) query << FuzzyRealty::Parameter.new(:location, 'A',true) query << FuzzyRealty::Parameter.new(:style,"Condominium",true) query << FuzzyRealty::Parameter.new(:sqft,1575,true) puts "Running score calculation 10 times..." scores = [] 10.times { |i| puts i; scores = FuzzyRealty::ExpertSystem.scores(listings,query) } puts "Query 1, $250k Condominium in the prestiguous 'A' suburbs. 1575 sq. ft." puts "Top 20 Listings:" scores[(0..20)].each do |score| puts "%.2f" % score[:score] + "\t\t#{score[:listing].inspect}" end puts "\n" query = FuzzyRealty::Query.new query << FuzzyRealty::Parameter.new(:price,99_000,true) query << FuzzyRealty::Parameter.new(:location,'C') query << FuzzyRealty::Parameter.new(:style, "Bungalow") query << FuzzyRealty::Parameter.new(:sqft,1200) puts "Running score calculation 10 times..." 10.times { |i| puts i; scores = FuzzyRealty::ExpertSystem.scores(listings,query) } puts "Query 2, $99k Bungalow in the ever so average 'C' block. 1200 sq. ft." puts "Top 20 Listings:" scores[(0..20)].each do |score| puts "%.2f" % score[:score] + "\t\t#{score[:listing].inspect}" end result = RubyProf.stop printer = RubyProf::GraphHtmlPrinter.new(result) printer.print(STDOUT, :min_percent=>0)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rkneufeld-fuzzy-realty-0.6.2 | lib/profiler.rb |
rkneufeld-fuzzy-realty-0.7.0 | lib/profiler.rb |