-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
83 lines (70 loc) · 1.9 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# frozen_string_literal: true
require './lib/mudf'
require 'open-uri'
N = 100
desc 'Get the MUDF data'
task :get_csv do
# https://www.imls.gov/research-evaluation/data-collection/museum-universe-data-file
puts 'Downloading…'
src = open('https://www.imls.gov/sites/default/files/mudf15q3pub_csv.zip')
dst = File.open('./mudf15q3pub_csv.zip', 'w')
dst.write(src.read)
puts 'Decompressing…'
system "unzip #{dst.path}"
puts 'Done.'
end
namespace :mongo do
desc 'Load MUDF data into Mongo'
task :load do
loader = MUDF::Loader::Mongo.new
loader.load
end
desc 'Run benchmark queries against Mongo'
task :benchmark do
benchmark = MUDF::Benchmark::Mongo.new
print 'Mongo'
benchmark.measure(n: N)
end
end
namespace :elasticsearch do
desc 'Load MUDF data into Elasticsearch'
task :load do
loader = MUDF::Loader::Elasticsearch.new
loader.load
end
desc 'Run benchmark queries against Elasticsearch'
task :benchmark do
benchmark = MUDF::Benchmark::Elasticsearch.new
benchmark.measure(n: N)
end
end
namespace :postgres do
desc 'Load MUDF data into Postgres/PostGIS'
task :load do
loader = MUDF::Loader::Postgres.new
loader.load
end
desc 'Run benchmark queries against Postgres/PostGIS'
task :benchmark do
benchmark = MUDF::Benchmark::Postgres.new
print 'PostGIS'
benchmark.measure(n: N)
end
end
desc 'Load all the things'
task load: %i[mongo:load elasticsearch:load postgres:load]
desc 'Benchmark all the things'
task :benchmark do
mongo = MUDF::Benchmark::Mongo.new
postgres = MUDF::Benchmark::Postgres.new
elasticsearch = MUDF::Benchmark::Elasticsearch.new
Benchmark.bmbm do |x|
x.report('Mongo') { N.times { mongo.run } }
x.report('Postgres') { N.times { postgres.run } }
x.report('Elastic') { N.times { elasticsearch.run } }
end
end
desc "Open a pry console"
task :pry do
require 'pry'; binding.pry
end