in profile/benchmarking/simple.rb [374:410]
def update_document(opts={})
results = []
action_iterations = 1_000
duration = with_cleanup do
document = small_document
id = client.create(index: INDEX, body: document)['_id']
field = document.find { |k,v| k != 'id' && v.is_a?(String) }.first
warmup_repetitions.times do |i|
client.update(index: INDEX,
id: id,
body: { doc: { field: "#{document[field]}-#{i}" } })
end
Benchmark.realtime do
results = measured_repetitions.times.collect do
Benchmark.realtime do
action_iterations.times do |i|
client.update(index: INDEX,
id: id,
body: { doc: { field: "#{document[field]}-#{i}" } })
end
end
end
end
end
options = { duration: duration,
operation: __method__,
dataset: 'small_document',
dataset_size: ObjectSpace.memsize_of(small_document),
dataset_n_documents: 1,
action_iterations: action_iterations }
index_results!(results, options)
end