rkneufeld-fuzzy-realty 0.6.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +2 -2
- data/lib/benchmark.rb +20 -0
- data/lib/fuzzy_realty.rb +0 -20
- metadata +2 -1
data/VERSION.yml
CHANGED
data/lib/benchmark.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'fuzzy_realty.rb'
|
2
|
+
|
3
|
+
puts "Benchmarking search through 100,000-1 (powers of ten) random listings"
|
4
|
+
puts "======================================================================="
|
5
|
+
listings = []
|
6
|
+
100_000.times { listings << FuzzyRealty::Listing.random }
|
7
|
+
puts "Generated #{listings.count} random listings"
|
8
|
+
Benchmark.bm do |x|
|
9
|
+
x.report("100,000 listings:") { FuzzyRealty::ExpertSystem.scores(listings,Query.random) }
|
10
|
+
listings = listings[(0...10_000)]
|
11
|
+
x.report("10,000 listings:") { FuzzyRealty::ExpertSystem.scores(listings,Query.random) }
|
12
|
+
listings = listings[(0...1_000)]
|
13
|
+
x.report("1,000 listings:") { FuzzyRealty::ExpertSystem.scores(listings,Query.random) }
|
14
|
+
listings = listings[(0...100)]
|
15
|
+
x.report("100 listings:") { FuzzyRealty::ExpertSystem.scores(listings,Query.random) }
|
16
|
+
listings = listings[(0...10)]
|
17
|
+
x.report("10 listings:") { FuzzyRealty::ExpertSystem.scores(listings,Query.random) }
|
18
|
+
listings = listings[(0...1)]
|
19
|
+
x.report("1 listing:") { FuzzyRealty::ExpertSystem.scores(listings,Query.random) }
|
20
|
+
end
|
data/lib/fuzzy_realty.rb
CHANGED
@@ -28,26 +28,6 @@ module FuzzyRealty
|
|
28
28
|
end
|
29
29
|
return scores.sort {|a,b| b[:score] <=> a[:score]}
|
30
30
|
end
|
31
|
-
def self.performance
|
32
|
-
puts "Benchmarking search through 100,000-1 (powers of ten) random listings"
|
33
|
-
puts "======================================================================="
|
34
|
-
listings = []
|
35
|
-
100_000.times { listings << Listing.random }
|
36
|
-
puts "Generated #{listings.count} random listings"
|
37
|
-
Benchmark.bm do |x|
|
38
|
-
x.report("100,000 listings:") { ExpertSystem.scores(listings,Query.random) }
|
39
|
-
listings = listings[(0...10_000)]
|
40
|
-
x.report("10,000 listings:") { ExpertSystem.scores(listings,Query.random) }
|
41
|
-
listings = listings[(0...1_000)]
|
42
|
-
x.report("1,000 listings:") { ExpertSystem.scores(listings,Query.random) }
|
43
|
-
listings = listings[(0...100)]
|
44
|
-
x.report("100 listings:") { ExpertSystem.scores(listings,Query.random) }
|
45
|
-
listings = listings[(0...10)]
|
46
|
-
x.report("10 listings:") { ExpertSystem.scores(listings,Query.random) }
|
47
|
-
listings = listings[(0...1)]
|
48
|
-
x.report("1 listing:") { ExpertSystem.scores(listings,Query.random) }
|
49
|
-
end
|
50
|
-
end
|
51
31
|
end
|
52
32
|
end
|
53
33
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rkneufeld-fuzzy-realty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Neufeld
|
@@ -28,6 +28,7 @@ files:
|
|
28
28
|
- Rakefile
|
29
29
|
- VERSION.yml
|
30
30
|
- lib/TODO
|
31
|
+
- lib/benchmark.rb
|
31
32
|
- lib/classes.rb
|
32
33
|
- lib/fuzzy_realty.rb
|
33
34
|
- lib/profiler.rb
|