From 56fde984927f599862528b577ef568c71ecf35ef Mon Sep 17 00:00:00 2001 From: Philippe PITTOLI Date: Sat, 11 May 2024 02:19:03 +0200 Subject: [PATCH] Some cleaning. --- spec/benchmark-cars.cr | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/spec/benchmark-cars.cr b/spec/benchmark-cars.cr index 837ae92..33682e3 100644 --- a/spec/benchmark-cars.cr +++ b/spec/benchmark-cars.cr @@ -51,22 +51,15 @@ def batch(db_size, nb_run) cars_semi = DODB::SpecDataBase(Car).new "-semi" cars_uncached = DODB::SpecDataBase(Car).new - ram_searchby_name, ram_searchby_color, ram_searchby_keywords = ram_indexes cars_ram - cached_searchby_name, cached_searchby_color, cached_searchby_keywords = cached_indexes cars_cached - semi_searchby_name, semi_searchby_color, semi_searchby_keywords = cached_indexes cars_semi - uncached_searchby_name, uncached_searchby_color, uncached_searchby_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 + ram_Sby_name, ram_Sby_color, ram_Sby_keywords = ram_indexes cars_ram + cached_Sby_name, cached_Sby_color, cached_Sby_keywords = cached_indexes cars_cached + semi_Sby_name, semi_Sby_color, semi_Sby_keywords = cached_indexes cars_semi + uncached_Sby_name, uncached_Sby_color, uncached_Sby_keywords = uncached_indexes cars_uncached car_name_to_search = ENV["CARNAME"] rescue "Corvet-#{(db_size/2).to_i}" car_color_to_search = ENV["CARCOLOR"] rescue "red" car_keyword_to_search = ENV["CARKEYWORD"] rescue "spacious" - puts "" puts "" puts "NEW BATCH: db-size #{db_size}" puts "" @@ -86,16 +79,13 @@ def batch(db_size, nb_run) report(storage, nb_run, "#{name}_#{db_size}_tags") do corvet = search_keywords.get car_keyword_to_search end + puts "" } - prepare_env cars_ram, db_size, "ram_db_and_indexes", - ram_searchby_name, ram_searchby_color, ram_searchby_keywords, &fn - prepare_env cars_cached, db_size, "cached_db_and_indexes", - cached_searchby_name, cached_searchby_color, cached_searchby_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 + prepare_env cars_ram, db_size, "ram", ram_Sby_name, ram_Sby_color, ram_Sby_keywords, &fn + prepare_env cars_cached, db_size, "cached", cached_Sby_name, cached_Sby_color, cached_Sby_keywords, &fn + prepare_env cars_semi, db_size, "semi", semi_Sby_name, semi_Sby_color, semi_Sby_keywords, &fn + prepare_env cars_uncached, db_size, "uncached", uncached_Sby_name, uncached_Sby_color, uncached_Sby_keywords, &fn end 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_uncached = DODB::SpecDataBase(Car).new - ram_searchby_name, ram_searchby_color, ram_searchby_keywords = ram_indexes cars_ram - cached_searchby_name, cached_searchby_color, cached_searchby_keywords = cached_indexes cars_cached - semi_searchby_name, semi_searchby_color, semi_searchby_keywords = cached_indexes cars_semi - uncached_searchby_name, uncached_searchby_color, uncached_searchby_keywords = uncached_indexes cars_uncached + ram_indexes cars_ram + cached_indexes cars_cached + cached_indexes cars_semi + uncached_indexes cars_uncached avr = perform_add(cars_ram, nb_run) puts "(ram db and indexes) add a value (average on #{nb_run} tries): #{avr}"