@@ -41,3 +41,158 @@ namespace :docs do
4141 system "yardoc -o #{ out } --title mongo-#{ Mongo ::VERSION } "
4242 end
4343end
44+
45+ require_relative "profile/benchmarking"
46+
47+ # Some require data files, available from the drivers team. See the comments above each task for details."
48+ namespace :benchmark do
49+ desc "Run the driver benchmark tests."
50+
51+ namespace :micro do
52+ desc "Run the common driver micro benchmarking tests"
53+
54+ namespace :flat do
55+ desc "Benchmarking for flat bson documents."
56+
57+ # Requirement: A file in Mongo::Benchmarking::DATA_PATH, called flat_bson.json.
58+ task :encode do
59+ puts "MICRO BENCHMARK:: FLAT:: ENCODE"
60+ Mongo ::Benchmarking ::Micro . run ( :flat , :encode )
61+ end
62+
63+ # Requirement: A file in Mongo::Benchmarking::DATA_PATH, called flat_bson.json.
64+ task :decode do
65+ puts "MICRO BENCHMARK:: FLAT:: DECODE"
66+ Mongo ::Benchmarking ::Micro . run ( :flat , :decode )
67+ end
68+ end
69+
70+ namespace :deep do
71+ desc "Benchmarking for deep bson documents."
72+
73+ # Requirement: A file in Mongo::Benchmarking::DATA_PATH, called deep_bson.json.
74+ task :encode do
75+ puts "MICRO BENCHMARK:: DEEP:: ENCODE"
76+ Mongo ::Benchmarking ::Micro . run ( :deep , :encode )
77+ end
78+
79+ # Requirement: A file in Mongo::Benchmarking::DATA_PATH, called deep_bson.json.
80+ task :decode do
81+ puts "MICRO BENCHMARK:: DEEP:: DECODE"
82+ Mongo ::Benchmarking ::Micro . run ( :deep , :decode )
83+ end
84+ end
85+
86+ namespace :full do
87+ desc "Benchmarking for full bson documents."
88+
89+ # Requirement: A file in Mongo::Benchmarking::DATA_PATH, called full_bson.json.
90+ task :encode do
91+ puts "MICRO BENCHMARK:: FULL:: ENCODE"
92+ Mongo ::Benchmarking ::Micro . run ( :full , :encode )
93+ end
94+
95+ # Requirement: A file in Mongo::Benchmarking::DATA_PATH, called full_bson.json.
96+ task :decode do
97+ puts "MICRO BENCHMARK:: FULL:: DECODE"
98+ Mongo ::Benchmarking ::Micro . run ( :full , :decode )
99+ end
100+ end
101+ end
102+
103+ namespace :single_doc do
104+ desc "Run the common driver single-document benchmarking tests"
105+ task :command do
106+ puts "SINGLE DOC BENCHMARK:: COMMAND"
107+ Mongo ::Benchmarking ::SingleDoc . run ( :command )
108+ end
109+
110+ # Requirement: A file in Mongo::Benchmarking::DATA_PATH, called TWEET.json.
111+ task :find_one do
112+ puts "SINGLE DOC BENCHMARK:: FIND ONE BY ID"
113+ Mongo ::Benchmarking ::SingleDoc . run ( :find_one )
114+ end
115+
116+ # Requirement: A file in Mongo::Benchmarking::DATA_PATH, called SMALL_DOC.json.
117+ task :insert_one_small do
118+ puts "SINGLE DOC BENCHMARK:: INSERT ONE SMALL DOCUMENT"
119+ Mongo ::Benchmarking ::SingleDoc . run ( :insert_one_small )
120+ end
121+
122+ # Requirement: A file in Mongo::Benchmarking::DATA_PATH, called LARGE_DOC.json.
123+ task :insert_one_large do
124+ puts "SINGLE DOC BENCHMARK:: INSERT ONE LARGE DOCUMENT"
125+ Mongo ::Benchmarking ::SingleDoc . run ( :insert_one_large )
126+ end
127+ end
128+
129+ namespace :multi_doc do
130+ desc "Run the common driver multi-document benchmarking tests"
131+
132+ # Requirement: A file in Mongo::Benchmarking::DATA_PATH, called TWEET.json.
133+ task :find_many do
134+ puts "MULTI DOCUMENT BENCHMARK:: FIND MANY"
135+ Mongo ::Benchmarking ::MultiDoc . run ( :find_many )
136+ end
137+
138+ # Requirement: A file in Mongo::Benchmarking::DATA_PATH, called SMALL_DOC.json.
139+ task :bulk_insert_small do
140+ puts "MULTI DOCUMENT BENCHMARK:: BULK INSERT SMALL"
141+ Mongo ::Benchmarking ::MultiDoc . run ( :bulk_insert_small )
142+ end
143+
144+ # Requirement: A file in Mongo::Benchmarking::DATA_PATH, called LARGE_DOC.json.
145+ task :bulk_insert_large do
146+ puts "MULTI DOCUMENT BENCHMARK:: BULK INSERT LARGE"
147+ Mongo ::Benchmarking ::MultiDoc . run ( :bulk_insert_large )
148+ end
149+
150+ # Requirement: A file in Mongo::Benchmarking::DATA_PATH, called GRIDFS_LARGE.
151+ task :gridfs_upload do
152+ puts "MULTI DOCUMENT BENCHMARK:: GRIDFS UPLOAD"
153+ Mongo ::Benchmarking ::MultiDoc . run ( :gridfs_upload )
154+ end
155+
156+ # Requirement: A file in Mongo::Benchmarking::DATA_PATH, called GRIDFS_LARGE.
157+ task :gridfs_download do
158+ puts "MULTI DOCUMENT BENCHMARK:: GRIDFS DOWNLOAD"
159+ Mongo ::Benchmarking ::MultiDoc . run ( :gridfs_download )
160+ end
161+ end
162+
163+ namespace :parallel do
164+ desc "Run the common driver paralell ETL benchmarking tests"
165+
166+ # Requirement: A directory in Mongo::Benchmarking::DATA_PATH, called LDJSON_MULTI,
167+ # with the files used in this task.
168+ task :import do
169+ puts "PARALLEL ETL BENCHMARK:: IMPORT"
170+ Mongo ::Benchmarking ::Parallel . run ( :import )
171+ end
172+
173+ # Requirement: A directory in Mongo::Benchmarking::DATA_PATH, called LDJSON_MULTI,
174+ # with the files used in this task.
175+ # Requirement: Another directory in "#{Mongo::Benchmarking::DATA_PATH}/LDJSON_MULTI"
176+ # called 'output'.
177+ task :export do
178+ puts "PARALLEL ETL BENCHMARK:: EXPORT"
179+ Mongo ::Benchmarking ::Parallel . run ( :export )
180+ end
181+
182+ # Requirement: A directory in Mongo::Benchmarking::DATA_PATH, called GRIDFS_MULTI,
183+ # with the files used in this task.
184+ task :gridfs_upload do
185+ puts "PARALLEL ETL BENCHMARK:: GRIDFS UPLOAD"
186+ Mongo ::Benchmarking ::Parallel . run ( :gridfs_upload )
187+ end
188+
189+ # Requirement: A directory in Mongo::Benchmarking::DATA_PATH, called GRIDFS_MULTI,
190+ # with the files used in this task.
191+ # Requirement: Another directory in "#{Mongo::Benchmarking::DATA_PATH}/GRIDFS_MULTI"
192+ # called 'output'.
193+ task :gridfs_download do
194+ puts "PARALLEL ETL BENCHMARK:: GRIDFS DOWNLOAD"
195+ Mongo ::Benchmarking ::Parallel . run ( :gridfs_download )
196+ end
197+ end
198+ end
0 commit comments