Benchmarks: provide reports to simplify the code for statistical analysis.
This commit is contained in:
parent
f43669b3b7
commit
12732277d3
@ -29,6 +29,18 @@ class Context
|
||||
class_property incr = 1_000
|
||||
end
|
||||
|
||||
# To simplify the creation of graphs, it's better to have fake data for
|
||||
# partitions and tags that won't be actually covered.
|
||||
# 0 means the absence of data.
|
||||
def fake_report(name)
|
||||
durations = Array(Int32).new Context.nb_run, 0
|
||||
File.open("#{Context.report_dir}/#{name}.raw", "w") do |file|
|
||||
durations.each do |d|
|
||||
file.puts d
|
||||
end
|
||||
end
|
||||
puts "#{name}: no report"
|
||||
end
|
||||
def report(storage, name, &block)
|
||||
durations = run_n_times Context.nb_run, &block
|
||||
File.open("#{Context.report_dir}/#{name}.raw", "w") do |file|
|
||||
@ -98,11 +110,16 @@ def batch()
|
||||
report(storage, "#{name}_#{current_db_size}_index") do
|
||||
corvet = search_name.get name_to_search
|
||||
end
|
||||
report(storage, "#{name}_#{current_db_size}_partitions") do
|
||||
corvet = search_color.get? color_to_search
|
||||
end
|
||||
report(storage, "#{name}_#{current_db_size}_tags") do
|
||||
corvet = search_keywords.get? keyword_to_search
|
||||
if current_db_size <= Context.max_indexes
|
||||
report(storage, "#{name}_#{current_db_size}_partitions") do
|
||||
corvet = search_color.get? color_to_search
|
||||
end
|
||||
report(storage, "#{name}_#{current_db_size}_tags") do
|
||||
corvet = search_keywords.get? keyword_to_search
|
||||
end
|
||||
else
|
||||
fake_report("#{name}_#{current_db_size}_partitions")
|
||||
fake_report("#{name}_#{current_db_size}_tags")
|
||||
end
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user