From d0f311a6dc9478de5202f861d7b4502c266c9005 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sun, 22 Nov 2026 17:09:58 +0100 Subject: Update benchmarks and comment --- benchmarks/plot-benchmarks.py | 77 +++++++++++++++++++++++++++++++++---------- 1 file changed, 60 insertions(+), 17 deletions(-) (limited to 'benchmarks/plot-benchmarks.py') diff --git a/benchmarks/plot-benchmarks.py b/benchmarks/plot-benchmarks.py index dfd1f90..e72e13b 100644 --- a/benchmarks/plot-benchmarks.py +++ b/benchmarks/plot-benchmarks.py @@ -185,9 +185,9 @@ with open(benchmarks_4_threads, "w") as f: ) f.write("\n") f.write( - '\n' - '\n' - ) + '\n' + '\n' + ) f.write("\n") f.write("\n") @@ -223,9 +223,9 @@ with open(benchmarks_16_threads, "w") as f: ) f.write("\n") f.write( - '\n' - '\n' - ) + '\n' + '\n' + ) f.write("\n") f.write("\n") @@ -241,14 +241,35 @@ with open(benchmarks_all_solutions, "w") as f: f.write("\n") f.write("Time per cube (in seconds, lower is better).\n") f.write("\n") - print_table(f, results_h48.h48_all_solutions, None, None, False, False) + print_table( + f, + results_h48.h48_all_solutions, + None, + results_egg.egg_all_solutions, + False, + False, + ) f.write("\n") f.write( "Time per cube adjusted for table size " "(in seconds \\* GiB, lower is better).\n" ) f.write("\n") - print_table(f, results_h48.h48_all_solutions, None, None, True, False) + print_table( + f, + results_h48.h48_all_solutions, + None, + results_egg.egg_all_solutions, + True, + False + ) + f.write("\n") + f.write( + '\n' + '\n' + '\n' + '\n' + ) f.write("\n") f.write("\n") @@ -256,20 +277,33 @@ with open(benchmarks_all_solutions, "w") as f: def plot_comparison(title, hd, vd, ed, key): d = 1 if key == "superflip" else 25 - h48x = [sizes_h48[m]/(2**30) for m in hd.keys() if key in hd[m]] - vcubex = [sizes_vcube[m]/(2**30) for m in vd.keys() if key in vd[m]] - eggx = [sizes_egg[m]/(2**30) for m in ed.keys() if key in ed[m]] - h48y = [d[key] for _, d in hd.items() if key in d] - vcubey = [d[key] for _, d in vd.items() if key in d] - eggy = [d[key] for _, d in ed.items() if key in d] plt.clf() plt.title(title) plt.xlabel("Table size (GiB)") plt.ylabel("Time to solve (s / cube)") - plt.plot(h48x, h48y, "o--", label = "H48") - plt.plot(vcubex, vcubey, "o--", label = "vcube") - plt.plot(eggx, eggy, "o--", label = "egg") + + if hd is not None: + h48x = [ + sizes_h48[m]/(2**30) for m in hd.keys() if key in hd[m] + ] + h48y = [d[key] for _, d in hd.items() if key in d] + plt.plot(h48x, h48y, "o--", label = "H48") + + if vd is not None: + vcubex = [ + sizes_vcube[m]/(2**30) for m in vd.keys() if key in vd[m] + ] + vcubey = [d[key] for _, d in vd.items() if key in d] + plt.plot(vcubex, vcubey, "o--", label = "vcube") + + if ed is not None: + eggx = [ + sizes_egg[m]/(2**30) for m in ed.keys() if key in ed[m] + ] + eggy = [d[key] for _, d in ed.items() if key in d] + plt.plot(eggx, eggy, "o--", label = "egg") + plt.legend(loc = "right") filename = title.replace(" ", "").replace(",", "") + ".png" plt.savefig(benchmarks_img_dir / filename, dpi=300) @@ -278,8 +312,17 @@ def plot_comparison(title, hd, vd, ed, key): rh = results_h48.h48_single_thread rv = results_vcube.vcube_single_thread re = results_egg.egg_single_thread +rhall = results_h48.h48_all_solutions +reall = results_egg.egg_all_solutions for m in [17, 18, 19, 20]: plot_comparison(f"{m} moves 1 thread", rh, rv, re, m) + plot_comparison( + f"{m} moves all solutions, 16 threads", + rhall, + None, + reall, + m, + ) def plot_multithread_scatter(title, slow, fast): plt.clf() -- cgit v1.3