Some cleaning.

toying-with-ramdb
Philippe PITTOLI 2024-05-11 02:19:03 +02:00
parent 9d1da890f3
commit 56fde98492
1 changed files with 13 additions and 23 deletions

View File

@ -51,22 +51,15 @@ def batch(db_size, nb_run)
cars_semi = DODB::SpecDataBase(Car).new "-semi" cars_semi = DODB::SpecDataBase(Car).new "-semi"
cars_uncached = DODB::SpecDataBase(Car).new cars_uncached = DODB::SpecDataBase(Car).new
ram_searchby_name, ram_searchby_color, ram_searchby_keywords = ram_indexes cars_ram ram_Sby_name, ram_Sby_color, ram_Sby_keywords = ram_indexes cars_ram
cached_searchby_name, cached_searchby_color, cached_searchby_keywords = cached_indexes cars_cached cached_Sby_name, cached_Sby_color, cached_Sby_keywords = cached_indexes cars_cached
semi_searchby_name, semi_searchby_color, semi_searchby_keywords = cached_indexes cars_semi semi_Sby_name, semi_Sby_color, semi_Sby_keywords = cached_indexes cars_semi
uncached_searchby_name, uncached_searchby_color, uncached_searchby_keywords = uncached_indexes cars_uncached uncached_Sby_name, uncached_Sby_color, uncached_Sby_keywords = uncached_indexes cars_uncached
#puts "add some values"
#add_cars cars_ram, db_size
#add_cars cars_cached, db_size
#add_cars cars_semi, db_size
#add_cars cars_uncached, db_size
car_name_to_search = ENV["CARNAME"] rescue "Corvet-#{(db_size/2).to_i}" car_name_to_search = ENV["CARNAME"] rescue "Corvet-#{(db_size/2).to_i}"
car_color_to_search = ENV["CARCOLOR"] rescue "red" car_color_to_search = ENV["CARCOLOR"] rescue "red"
car_keyword_to_search = ENV["CARKEYWORD"] rescue "spacious" car_keyword_to_search = ENV["CARKEYWORD"] rescue "spacious"
puts ""
puts "" puts ""
puts "NEW BATCH: db-size #{db_size}" puts "NEW BATCH: db-size #{db_size}"
puts "" puts ""
@ -86,16 +79,13 @@ def batch(db_size, nb_run)
report(storage, nb_run, "#{name}_#{db_size}_tags") do 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 end
puts ""
} }
prepare_env cars_ram, db_size, "ram_db_and_indexes", prepare_env cars_ram, db_size, "ram", ram_Sby_name, ram_Sby_color, ram_Sby_keywords, &fn
ram_searchby_name, ram_searchby_color, ram_searchby_keywords, &fn prepare_env cars_cached, db_size, "cached", cached_Sby_name, cached_Sby_color, cached_Sby_keywords, &fn
prepare_env cars_cached, db_size, "cached_db_and_indexes", prepare_env cars_semi, db_size, "semi", semi_Sby_name, semi_Sby_color, semi_Sby_keywords, &fn
cached_searchby_name, cached_searchby_color, cached_searchby_keywords, &fn prepare_env cars_uncached, db_size, "uncached", uncached_Sby_name, uncached_Sby_color, uncached_Sby_keywords, &fn
prepare_env cars_semi, db_size, "semi_uncached_db_and_cached_indexes",
semi_searchby_name, semi_searchby_color, semi_searchby_keywords, &fn
prepare_env cars_uncached, db_size, "uncached_db_and_indexes",
uncached_searchby_name, uncached_searchby_color, uncached_searchby_keywords, &fn
end end
def perform_add(storage : DODB::Storage(Car), nb_run) def perform_add(storage : DODB::Storage(Car), nb_run)
@ -115,10 +105,10 @@ def batch_add(nb_run)
cars_semi = DODB::SpecDataBase(Car).new "-semi" cars_semi = DODB::SpecDataBase(Car).new "-semi"
cars_uncached = DODB::SpecDataBase(Car).new cars_uncached = DODB::SpecDataBase(Car).new
ram_searchby_name, ram_searchby_color, ram_searchby_keywords = ram_indexes cars_ram ram_indexes cars_ram
cached_searchby_name, cached_searchby_color, cached_searchby_keywords = cached_indexes cars_cached cached_indexes cars_cached
semi_searchby_name, semi_searchby_color, semi_searchby_keywords = cached_indexes cars_semi cached_indexes cars_semi
uncached_searchby_name, uncached_searchby_color, uncached_searchby_keywords = uncached_indexes cars_uncached uncached_indexes cars_uncached
avr = perform_add(cars_ram, nb_run) avr = perform_add(cars_ram, nb_run)
puts "(ram db and indexes) add a value (average on #{nb_run} tries): #{avr}" puts "(ram db and indexes) add a value (average on #{nb_run} tries): #{avr}"