Fix various benchmark pain points.

toying-with-ramdb
Philippe PITTOLI 2024-05-12 03:11:53 +02:00
parent c4fce3c4a4
commit cc5d6ff78f
1 changed files with 8 additions and 3 deletions

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