Skip to content

Commit 7f00039

Browse files
committed
[BENCHMARKING] Generate index names outside benchmarked block
1 parent 8d18693 commit 7f00039

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

profile/benchmarking/complex.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ def index_documents(opts = {})
5757
end
5858
end
5959
end_time = current_time
60-
results
6160
end
6261

6362
options = { duration: end_time - start,
@@ -103,7 +102,6 @@ def search_documents(opts = {})
103102
end
104103
end
105104
end_time = current_time
106-
results
107105
end
108106

109107
options = { duration: end_time - start,

profile/benchmarking/simple.rb

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ def create_index(opts = {})
8383

8484
with_cleanup do
8585
start = current_time
86-
results = measured_repetitions.times.collect do
86+
results = measured_repetitions.times.collect do |i|
87+
index_names = action_iterations.times.collect { |j| (measured_repetitions*i) + j }
8788
Benchmark.realtime do
88-
action_iterations.times do
89-
client.indices.create(index: "benchmarking-#{Time.now.to_f}")
89+
action_iterations.times do |j|
90+
client.indices.create(index: "benchmarking-#{index_names[j]}")
9091
end
9192
end
9293
end
9394
end_time = current_time
94-
results
9595
end
9696

9797
options = { duration: end_time - start,
@@ -131,7 +131,6 @@ def index_document_small(opts={})
131131
end
132132
end
133133
end_time = current_time
134-
results
135134
end
136135

137136
options = { duration: end_time - start,
@@ -174,7 +173,6 @@ def index_document_large(opts={})
174173
end
175174
end
176175
end_time = current_time
177-
results
178176
end
179177

180178
options = { duration: end_time - start,
@@ -217,7 +215,6 @@ def get_document_small(opts={})
217215
end
218216
end
219217
end_time = current_time
220-
results
221218
end
222219

223220
options = { duration: end_time - start,
@@ -337,7 +334,7 @@ def search_document_large(opts={})
337334
results = []
338335
action_iterations = 1_000
339336

340-
results = with_cleanup do
337+
with_cleanup do
341338
client.create(index: INDEX, body: large_document)
342339
search_criteria = { match: { 'user.lang': 'en' } }
343340
request = { body: { query: search_criteria } }
@@ -359,7 +356,6 @@ def search_document_large(opts={})
359356
end
360357
end
361358
end_time = current_time
362-
results
363359
end
364360

365361
options = { duration: end_time - start,
@@ -409,7 +405,6 @@ def update_document(opts={})
409405
end
410406
end
411407
end_time = current_time
412-
results
413408
end
414409

415410
options = { duration: end_time - start,

0 commit comments

Comments
 (0)