Fix various benchmark pain points.

This commit is contained in:
Philippe PITTOLI 2024-05-12 03:11:53 +02:00
parent 73e96ddf59
commit 5d6806d4a6

View File

@ -11,6 +11,7 @@ require "./db-cars.cr"
# ENV["DBSIZE_INCREMENT"] rescue 1_000
# ENV["REPORT_DIR"] rescue "results"
# ENV["NBRUN"] rescue 100
# ENV["INDEXESMAXIT"] rescue 5000
class DODB::Storage(V)
def empty_db
@ -37,7 +38,8 @@ end
def prepare_env(storage, db_size, name, s_index, s_partition, s_tags, &)
STDOUT.write "add #{db_size} values to #{name}\r".to_slice
add_cars storage, db_size
index_max_iterations = ENV["INDEXESMAXIT"].to_i rescue 5_000
add_cars storage, db_size, max_it_tags: (db_size > index_max_iterations ? 0 : 5000)
STDOUT.write " \r".to_slice
yield storage, name, s_index, s_partition, s_tags
@ -74,10 +76,10 @@ def batch(db_size, nb_run)
corvet = search_name.get car_name_to_search
end
report(storage, nb_run, "#{name}_#{db_size}_partitions") do
corvet = search_color.get car_color_to_search
corvet = search_color.get? car_color_to_search
end
report(storage, nb_run, "#{name}_#{db_size}_tags") do
corvet = search_keywords.get car_keyword_to_search
corvet = search_keywords.get? car_keyword_to_search
end
puts ""
}
@ -137,17 +139,20 @@ nb_run = ENV["NBRUN"].to_i rescue 100
db_size_max = ENV["DBSIZE"].to_i rescue 40_000
current_size = ENV["DBSIZE_START"].to_i rescue 5_000
size_increment = ENV["DBSIZE_INCREMENT"].to_i rescue 1_000
index_max_iterations = ENV["INDEXESMAXIT"].to_i rescue 5_000
# ENV["DBSIZE"] rescue 40_000
# ENV["DBSIZE_START"] rescue 5_000
# ENV["DBSIZE_INCREMENT"] rescue 1_000
# ENV["REPORT_DIR"] rescue "results"
# ENV["NBRUN"] rescue 100
# ENV["INDEXESMAXIT"] rescue 5000
pp! nb_run
pp! db_size_max
pp! current_size
pp! size_increment
pp! index_max_iterations
while current_size <= db_size_max
batch current_size, nb_run