From 5d6806d4a6b0fc6a7c09d3957262c8ce20316c47 Mon Sep 17 00:00:00 2001 From: Philippe PITTOLI Date: Sun, 12 May 2024 03:11:53 +0200 Subject: [PATCH] Fix various benchmark pain points. --- spec/benchmark-cars.cr | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/spec/benchmark-cars.cr b/spec/benchmark-cars.cr index 33682e3..bfbf1e1 100644 --- a/spec/benchmark-cars.cr +++ b/spec/benchmark-cars.cr @@ -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