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/benchmarks.md | 125 ++++++++++++++++++++++++++++------------------- 1 file changed, 75 insertions(+), 50 deletions(-) (limited to 'benchmarks/benchmarks.md') diff --git a/benchmarks/benchmarks.md b/benchmarks/benchmarks.md index 4f36cac..d6ec328 100644 --- a/benchmarks/benchmarks.md +++ b/benchmarks/benchmarks.md @@ -4,16 +4,16 @@ This page contains some benchmarks for some of the possible configurations of the H48 optimal solver. For comparison we also include similar measurements for two other optimal solvers: -* Andrew Skalski's [vcube](https://github.com/Voltara/vcube), which - is a truly impressive implementation of Tomas Rokicki's +* Andrew Skalski's [vcube](https://github.com/Voltara/vcube) (commit + 9f5bc2c), which is a truly impressive implementation of Tomas Rokicki's [nxopt](https://github.com/rokicki/cube20src/blob/master/nxopt.md) that has been taken as a reference throughout the development of H48. This solver also uses an A* search, but the search is supported by different pruning tables. * Arhan Chaudhary's - [egg-solver](https://github.com/ArhanChaudhary/egg-solver), which - is an AI-generated implementation of the H48 method with - highly-optimized microthreading. + [egg-solver](https://github.com/ArhanChaudhary/egg-solver) (commit + c3eb909), which is an AI-generated implementation of the H48 method + with highly-optimized microthreading. Similar benchmarks can be found: @@ -25,7 +25,7 @@ Similar benchmarks can be found: * In Enrico Tenuti's [thesis](https://github.com/enricotenuti/h48thesis), also using an old implementation of H48, but including more data and nice plots. -* In [the documentation page](https://egg-solver/arhan.sh/docs/index.html) +* In [the documentation page](https://egg-solver.arhan.sh/docs/index.html) for egg-solver. ## Setting @@ -85,21 +85,21 @@ Time per cube (in seconds, lower is better). |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |:-----|:---|-------:|-------:|-------:|-------:|--------:| |vcube 212 |58.2 GiB| 0.11| 0.75| 3.43| 27.28| 19.30| -|egg h11 |58.0 GiB| 0.01| 0.06| 0.24| 2.16| 0.14| +|egg h11 |58.0 GiB| 0.01| 0.06| 0.24| 2.14| 0.14| |H48 h11 |56.5 GiB| 0.08| 0.43| 1.86| 12.20| 15.39| |vcube 404 |31.8 GiB| 0.23| 1.24| 6.10| 59.33| 268.26| -|egg h10 |29.0 GiB| 0.02| 0.10| 0.47| 4.00| 0.23| +|egg h10 |29.0 GiB| 0.02| 0.10| 0.46| 3.96| 0.24| |H48 h10 |28.3 GiB| 0.13| 0.69| 3.37| 23.15| 38.00| |vcube 308 |21.2 GiB| 0.17| 1.02| 6.20| 58.70| 604.35| -|egg h9 |14.5 GiB| 0.03| 0.19| 0.91| | | +|egg h9 |14.5 GiB| 0.03| 0.21| 0.98| | | |H48 h9 |14.1 GiB| 0.22| 1.43| 6.56| | | |vcube 208 | 7.3 GiB| 0.56| 4.36| 20.58| | | -|egg h8 | 7.2 GiB| 0.07| 0.39| 1.82| | | +|egg h8 | 7.2 GiB| 0.06| 0.36| 1.69| | | |H48 h8 | 7.1 GiB| 0.46| 3.43| 14.18| | | -|egg h7 | 3.6 GiB| 0.11| 0.81| 4.35| | | +|egg h7 | 3.6 GiB| 0.10| 0.74| 3.88| | | |H48 h7 | 3.5 GiB| 0.63| 4.84| 23.31| | | |vcube 112 | 2.4 GiB| 0.96| 9.29| 40.52| | | -|egg h6 | 1.8 GiB| 0.20| 1.53| 8.19| | | +|egg h6 | 1.8 GiB| 0.21| 1.60| 8.62| | | |H48 h6 | 1.8 GiB| 1.26| 9.51| 47.14| | | Time per cube adjusted for table size (in seconds \* GiB, lower is better). @@ -107,21 +107,21 @@ Time per cube adjusted for table size (in seconds \* GiB, lower is better). |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |:-----|:---|-------:|-------:|-------:|-------:|--------:| |vcube 212 |58.2 GiB| 6.43| 43.80| 199.38| 1587.43| 1122.73| -|egg h11 |58.0 GiB| 0.55| 3.31| 13.99| 125.17| 8.04| +|egg h11 |58.0 GiB| 0.55| 3.32| 13.97| 124.06| 7.93| |H48 h11 |56.5 GiB| 4.56| 24.55| 104.96| 689.22| 869.37| |vcube 404 |31.8 GiB| 7.40| 39.47| 194.01| 1887.94| 8535.87| -|egg h10 |29.0 GiB| 0.50| 2.90| 13.69| 115.88| 6.80| +|egg h10 |29.0 GiB| 0.48| 2.85| 13.48| 114.83| 7.08| |H48 h10 |28.3 GiB| 3.62| 19.45| 95.15| 654.05| 1073.69| |vcube 308 |21.2 GiB| 3.51| 21.71| 131.50| 1245.26| 12819.94| -|egg h9 |14.5 GiB| 0.47| 2.74| 13.19| | | +|egg h9 |14.5 GiB| 0.50| 3.00| 14.22| | | |H48 h9 |14.1 GiB| 3.11| 20.18| 92.68| | | |vcube 208 | 7.3 GiB| 4.08| 31.74| 149.68| | | -|egg h8 | 7.2 GiB| 0.48| 2.82| 13.16| | | +|egg h8 | 7.2 GiB| 0.45| 2.63| 12.27| | | |H48 h8 | 7.1 GiB| 3.23| 24.26| 100.15| | | -|egg h7 | 3.6 GiB| 0.39| 2.94| 15.77| | | +|egg h7 | 3.6 GiB| 0.36| 2.69| 14.05| | | |H48 h7 | 3.5 GiB| 2.22| 17.12| 82.35| | | |vcube 112 | 2.4 GiB| 2.33| 22.53| 98.23| | | -|egg h6 | 1.8 GiB| 0.36| 2.76| 14.83| | | +|egg h6 | 1.8 GiB| 0.37| 2.89| 15.62| | | |H48 h6 | 1.8 GiB| 2.24| 16.80| 83.33| | | @@ -131,9 +131,10 @@ Time per cube adjusted for table size (in seconds \* GiB, lower is better). As we can see, egg-solver is the clear winner, consistently beating H48 by -factors of 5.3x-8.8x for 17-19 moves scrambles, comparing tables of similar +factors of 5x-9x for all sets of scrambles, comparing tables of similar size. Moreover, egg-solver is more than 100 times faster when solving the -superflip configuration. +superflip configuration, likely due to better expoitation of symmetries, +including inverse positions. Adjusting for table size, H48 is generally faster than vcube. The gap between the two solvers is larger for scrambles with longer optimal solutions. @@ -144,8 +145,9 @@ The same benchmark as before is repeated using 4 and 16 threads (recall that the CPU used for these tests has 8 physical cores and 16 virtual threads). -For the reasons mentioned above, we will only compare H48 and egg-solver -in this section. +For the reasons mentioned above, in this section we will only compare H48 +and egg-solver; for the latter with enable per-cube parallelization using +the `-c 1` option.
Results: Single solution, 4 threads @@ -156,32 +158,32 @@ Time per cube (in seconds, lower is better). |:-----|:---|-------:|-------:|-------:|-------:|--------:| |egg h11 |58.0 GiB| 0.00| 0.01| 0.06| 0.55| 0.03| |H48 h11 |56.5 GiB| 0.03| 0.13| 0.50| 3.24| 4.17| -|egg h10 |29.0 GiB| 0.00| 0.03| 0.12| 1.05| 0.09| +|egg h10 |29.0 GiB| 0.00| 0.02| 0.12| 1.02| 0.09| |H48 h10 |28.3 GiB| 0.05| 0.18| 0.90| 6.21| 9.85| -|egg h9 |14.5 GiB| 0.01| 0.05| 0.23| | | +|egg h9 |14.5 GiB| 0.01| 0.05| 0.25| | | |H48 h9 |14.1 GiB| 0.07| 0.39| 1.73| 12.50| 18.97| -|egg h8 | 7.2 GiB| 0.02| 0.10| 0.48| | | +|egg h8 | 7.2 GiB| 0.02| 0.09| 0.43| | | |H48 h8 | 7.1 GiB| 0.13| 0.91| 3.71| | | -|egg h7 | 3.6 GiB| 0.03| 0.21| 1.11| | | +|egg h7 | 3.6 GiB| 0.03| 0.19| 1.08| | | |H48 h7 | 3.5 GiB| 0.18| 1.29| 6.19| | | -|egg h6 | 1.8 GiB| 0.05| 0.39| 2.11| | | +|egg h6 | 1.8 GiB| 0.05| 0.39| 2.23| | | |H48 h6 | 1.8 GiB| 0.34| 2.48| 12.33| | | Speed-up factor (higher is better). |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |:-----|:---|-------:|-------:|-------:|-------:|--------:| -|egg h11 |58.0 GiB| 3.77| 3.90| 3.89| 3.93| 5.42| +|egg h11 |58.0 GiB| 3.57| 3.85| 3.72| 3.90| 5.41| |H48 h11 |56.5 GiB| 2.51| 3.44| 3.75| 3.77| 3.69| -|egg h10 |29.0 GiB| 3.88| 3.77| 3.98| 3.81| 2.72| +|egg h10 |29.0 GiB| 3.68| 4.03| 3.92| 3.89| 2.78| |H48 h10 |28.3 GiB| 2.79| 3.91| 3.75| 3.73| 3.86| -|egg h9 |14.5 GiB| 3.90| 3.87| 3.88| | | +|egg h9 |14.5 GiB| 3.80| 4.20| 3.91| | | |H48 h9 |14.1 GiB| 3.18| 3.66| 3.79| | | -|egg h8 | 7.2 GiB| 3.87| 3.91| 3.81| | | +|egg h8 | 7.2 GiB| 3.81| 4.01| 3.91| | | |H48 h8 | 7.1 GiB| 3.48| 3.78| 3.82| | | -|egg h7 | 3.6 GiB| 3.87| 3.87| 3.93| | | +|egg h7 | 3.6 GiB| 3.81| 3.88| 3.59| | | |H48 h7 | 3.5 GiB| 3.43| 3.75| 3.77| | | -|egg h6 | 1.8 GiB| 3.98| 3.90| 3.87| | | +|egg h6 | 1.8 GiB| 3.93| 4.09| 3.87| | | |H48 h6 | 1.8 GiB| 3.73| 3.84| 3.82| | | @@ -196,34 +198,34 @@ Time per cube (in seconds, lower is better). |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |:-----|:---|-------:|-------:|-------:|-------:|--------:| -|egg h11 |58.0 GiB| 0.00| 0.01| 0.03| 0.27| 0.02| +|egg h11 |58.0 GiB| 0.00| 0.01| 0.03| 0.28| 0.02| |H48 h11 |56.5 GiB| 0.02| 0.06| 0.21| 1.16| 1.84| -|egg h10 |29.0 GiB| 0.00| 0.02| 0.09| 0.77| 0.04| +|egg h10 |29.0 GiB| 0.00| 0.01| 0.06| 0.50| 0.03| |H48 h10 |28.3 GiB| 0.03| 0.08| 0.34| 2.24| 4.21| -|egg h9 |14.5 GiB| 0.01| 0.04| 0.17| | | +|egg h9 |14.5 GiB| 0.00| 0.02| 0.11| | | |H48 h9 |14.1 GiB| 0.03| 0.14| 0.64| 4.43| 8.04| -|egg h8 | 7.2 GiB| 0.01| 0.07| 0.33| | | +|egg h8 | 7.2 GiB| 0.01| 0.04| 0.21| | | |H48 h8 | 7.1 GiB| 0.06| 0.30| 1.36| | | -|egg h7 | 3.6 GiB| 0.02| 0.15| 0.79| | | +|egg h7 | 3.6 GiB| 0.01| 0.09| 0.53| | | |H48 h7 | 3.5 GiB| 0.08| 0.41| 2.20| | | -|egg h6 | 1.8 GiB| 0.04| 0.28| 1.53| | | +|egg h6 | 1.8 GiB| 0.02| 0.18| 0.97| | | |H48 h6 | 1.8 GiB| 0.13| 0.77| 4.37| | | Speed-up factor (higher is better). |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |:-----|:---|-------:|-------:|-------:|-------:|--------:| -|egg h11 |58.0 GiB| 5.56| 8.03| 8.00| 8.05| 8.45| +|egg h11 |58.0 GiB| 6.27| 7.35| 7.59| 7.76| 7.61| |H48 h11 |56.5 GiB| 3.73| 7.32| 8.87| 10.54| 8.35| -|egg h10 |29.0 GiB| 5.63| 5.58| 5.53| 5.18| 6.05| +|egg h10 |29.0 GiB| 6.86| 8.10| 8.02| 7.92| 7.13| |H48 h10 |28.3 GiB| 4.76| 8.60| 9.84| 10.34| 9.03| -|egg h9 |14.5 GiB| 5.46| 5.32| 5.35| | | +|egg h9 |14.5 GiB| 7.84| 9.10| 8.56| | | |H48 h9 |14.1 GiB| 6.34| 10.07| 10.19| | | -|egg h8 | 7.2 GiB| 5.49| 5.50| 5.53| | | +|egg h8 | 7.2 GiB| 7.71| 8.36| 8.04| | | |H48 h8 | 7.1 GiB| 7.51| 11.36| 10.43| | | -|egg h7 | 3.6 GiB| 5.33| 5.38| 5.48| | | +|egg h7 | 3.6 GiB| 8.00| 8.15| 7.32| | | |H48 h7 | 3.5 GiB| 8.21| 11.75| 10.61| | | -|egg h6 | 1.8 GiB| 5.51| 5.42| 5.35| | | +|egg h6 | 1.8 GiB| 8.62| 8.96| 8.89| | | |H48 h6 | 1.8 GiB| 9.38| 12.31| 10.80| | | @@ -237,15 +239,17 @@ getting close to the 4x theoretical maximum speedup in slower cases speedup for the superflip, likely due to single-scramble variance, i.e. the thread that found the solution stopped earlier. -In the 16 threads benchmark shows that, although the virtual threads -help push H48 beyond the 8x theoretical speedup that would be provided -by the 8 cores, it is nowhere near a 16x speedup. egg-solver seems -stuck around 5.5x speedup. +The 16 threads benchmark shows that, although the virtual threads help +push H48 beyond the 8x theoretical speedup that would be provided by the +8 cores, it is nowhere near a 16x speedup. Moreover, egg-solver does not +seem to take advantage of the CPU's hyperthreading, likely because its +own custom micro-threading is based on the same principle and it saturates +any possible speedup that hyperthreading could provide. ### All solutions Finally, we ran a test on finding *all* optimal solutions which, as -far as I know, is a use case not supported by vcube or egg-solver. +far as I know, is a use case only supported by H48 and egg-solver. For convenience, this test is only run on 16 threads. @@ -255,26 +259,46 @@ Time per cube (in seconds, lower is better). |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |:-----|:---|-------:|-------:|-------:|-------:|--------:| +|egg h11 |58.0 GiB| 0.00| 0.05| 0.54| 5.08| 15.38| |H48 h11 |56.5 GiB| 0.04| 0.24| 1.88| 3.88| 1.86| +|egg h10 |29.0 GiB| 0.01| 0.09| 1.00| 9.42| 31.05| |H48 h10 |28.3 GiB| 0.05| 0.39| 3.51| 7.54| 4.29| +|egg h9 |14.5 GiB| 0.01| 0.17| 1.97| | | |H48 h9 |14.1 GiB| 0.08| 0.73| 6.92| | | +|egg h8 | 7.2 GiB| 0.03| 0.31| 3.49| | | |H48 h8 | 7.1 GiB| 0.16| 1.54| 14.78| | | +|egg h7 | 3.6 GiB| 0.04| 0.57| 6.38| | | |H48 h7 | 3.5 GiB| 0.22| 2.37| 25.35| | | +|egg h6 | 1.8 GiB| 0.10| 1.27| 14.93| | | |H48 h6 | 1.8 GiB| 0.40| 4.58| 50.17| | | Time per cube adjusted for table size (in seconds \* GiB, lower is better). |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |:-----|:---|-------:|-------:|-------:|-------:|--------:| +|egg h11 |58.0 GiB| 0.25| 2.88| 31.12| 294.67| 892.07| |H48 h11 |56.5 GiB| 2.00| 13.40| 106.21| 219.43| 105.10| +|egg h10 |29.0 GiB| 0.22| 2.58| 28.89| 273.08| 900.34| |H48 h10 |28.3 GiB| 1.45| 11.13| 99.17| 212.94| 121.20| +|egg h9 |14.5 GiB| 0.21| 2.51| 28.49| | | |H48 h9 |14.1 GiB| 1.13| 10.25| 97.80| | | +|egg h8 | 7.2 GiB| 0.18| 2.25| 25.30| | | |H48 h8 | 7.1 GiB| 1.10| 10.85| 104.41| | | +|egg h7 | 3.6 GiB| 0.16| 2.05| 23.11| | | |H48 h7 | 3.5 GiB| 0.79| 8.38| 89.57| | | +|egg h6 | 1.8 GiB| 0.18| 2.29| 27.06| | | |H48 h6 | 1.8 GiB| 0.71| 8.10| 88.68| | | + + + + +
+For all-solutions egg-solver's advantage reduces to 3x-4x, and for +20 moves scrambles it appears to be even slower than H48. + ## Other notes * To repeat the benchmarks for H48, use `./benchmarks/run-h48-benchmarks.sh`. @@ -291,6 +315,7 @@ Time per cube adjusted for table size (in seconds \* GiB, lower is better). them. Both apporaches have pros and cons: vcube's approch has less overhead in coordination between the threads, but often some threads may be left without work when there are no more cubes left to solve. + egg-solver supports both modes via the `-c` option. * Per-cube parallelization means that H48 will always be faster than vcube when solving a single cube. * vcube only supports x86 processors (Intel, AMD), while H48 runs on any -- cgit v1.3