diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-10 16:04:06 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-10 16:04:06 +0100 |
| commit | 73e64898e36cb2cdad5ec03ac907ed9e866fd5a2 (patch) | |
| tree | 50ca4b2b015c9f4ce8cb19d25511c7d72e16e4e6 /benchmark/cube-bench.c | |
| parent | fb9ae9e41eaf01b3651395fdd450ac1a4743e592 (diff) | |
| download | nissy-core-73e64898e36cb2cdad5ec03ac907ed9e866fd5a2.tar.gz nissy-core-73e64898e36cb2cdad5ec03ac907ed9e866fd5a2.zip | |
"Fixed" benchmark (actually removed)
Diffstat (limited to 'benchmark/cube-bench.c')
| -rw-r--r-- | benchmark/cube-bench.c | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/benchmark/cube-bench.c b/benchmark/cube-bench.c new file mode 100644 index 0000000..26d12a4 --- /dev/null +++ b/benchmark/cube-bench.c | |||
| @@ -0,0 +1,147 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | Section: benchmarks | ||
| 3 | |||
| 4 | Here you can find some simple functions that can be used to benchmark the | ||
| 5 | rest of the code. | ||
| 6 | ******************************************************************************/ | ||
| 7 | |||
| 8 | #define RANDOMCUBES 157 | ||
| 9 | |||
| 10 | static void | ||
| 11 | setup_randomcubes(cube_fast_t *cubes) | ||
| 12 | { | ||
| 13 | int i; | ||
| 14 | |||
| 15 | for (i = 0; i < RANDOMCUBES; i++) | ||
| 16 | cubes[i] = run_moves(i*4); | ||
| 17 | } | ||
| 18 | |||
| 19 | cube_t | ||
| 20 | run_moves(int64_t n) | ||
| 21 | { | ||
| 22 | cube_fast_t fast; | ||
| 23 | int64_t m, i; | ||
| 24 | |||
| 25 | fast = solvedcube(); | ||
| 26 | m = n / 18; | ||
| 27 | |||
| 28 | for (i = 0; i < m; i++) { | ||
| 29 | fast = _move_U(fast); | ||
| 30 | fast = _move_U2(fast); | ||
| 31 | fast = _move_U3(fast); | ||
| 32 | fast = _move_D(fast); | ||
| 33 | fast = _move_D2(fast); | ||
| 34 | fast = _move_D3(fast); | ||
| 35 | fast = _move_R(fast); | ||
| 36 | fast = _move_R2(fast); | ||
| 37 | fast = _move_R3(fast); | ||
| 38 | fast = _move_L(fast); | ||
| 39 | fast = _move_L2(fast); | ||
| 40 | fast = _move_L3(fast); | ||
| 41 | fast = _move_F(fast); | ||
| 42 | fast = _move_F2(fast); | ||
| 43 | fast = _move_F3(fast); | ||
| 44 | fast = _move_B(fast); | ||
| 45 | fast = _move_B2(fast); | ||
| 46 | fast = _move_B3(fast); | ||
| 47 | } | ||
| 48 | |||
| 49 | for (i = m * 18; i < n; i++) | ||
| 50 | fast = _move_F(fast); | ||
| 51 | |||
| 52 | return fast; | ||
| 53 | } | ||
| 54 | |||
| 55 | cube_t | ||
| 56 | run_trans(int64_t n) | ||
| 57 | { | ||
| 58 | cube_fast_t fast; | ||
| 59 | int64_t m, i; | ||
| 60 | |||
| 61 | fast = run_moves(33); | ||
| 62 | m = n / 18; | ||
| 63 | |||
| 64 | for (i = 0; i < m; i++) { | ||
| 65 | fast = _trans_UFr(fast); | ||
| 66 | fast = _trans_ULr(fast); | ||
| 67 | fast = _trans_UBr(fast); | ||
| 68 | fast = _trans_URr(fast); | ||
| 69 | fast = _trans_DFr(fast); | ||
| 70 | fast = _trans_DLr(fast); | ||
| 71 | fast = _trans_DBr(fast); | ||
| 72 | fast = _trans_DRr(fast); | ||
| 73 | fast = _trans_RUr(fast); | ||
| 74 | fast = _trans_RFr(fast); | ||
| 75 | fast = _trans_RDr(fast); | ||
| 76 | fast = _trans_RBr(fast); | ||
| 77 | fast = _trans_LUr(fast); | ||
| 78 | fast = _trans_LFr(fast); | ||
| 79 | fast = _trans_LDr(fast); | ||
| 80 | fast = _trans_LBr(fast); | ||
| 81 | fast = _trans_FUr(fast); | ||
| 82 | fast = _trans_FRr(fast); | ||
| 83 | fast = _trans_FDr(fast); | ||
| 84 | fast = _trans_FLr(fast); | ||
| 85 | fast = _trans_BUr(fast); | ||
| 86 | fast = _trans_BRr(fast); | ||
| 87 | fast = _trans_BDr(fast); | ||
| 88 | fast = _trans_BLr(fast); | ||
| 89 | fast = _trans_UFm(fast); | ||
| 90 | fast = _trans_ULm(fast); | ||
| 91 | fast = _trans_UBm(fast); | ||
| 92 | fast = _trans_URm(fast); | ||
| 93 | fast = _trans_DFm(fast); | ||
| 94 | fast = _trans_DLm(fast); | ||
| 95 | fast = _trans_DBm(fast); | ||
| 96 | fast = _trans_DRm(fast); | ||
| 97 | fast = _trans_RUm(fast); | ||
| 98 | fast = _trans_RFm(fast); | ||
| 99 | fast = _trans_RDm(fast); | ||
| 100 | fast = _trans_RBm(fast); | ||
| 101 | fast = _trans_LUm(fast); | ||
| 102 | fast = _trans_LFm(fast); | ||
| 103 | fast = _trans_LDm(fast); | ||
| 104 | fast = _trans_LBm(fast); | ||
| 105 | fast = _trans_FUm(fast); | ||
| 106 | fast = _trans_FRm(fast); | ||
| 107 | fast = _trans_FDm(fast); | ||
| 108 | fast = _trans_FLm(fast); | ||
| 109 | fast = _trans_BUm(fast); | ||
| 110 | fast = _trans_BRm(fast); | ||
| 111 | fast = _trans_BDm(fast); | ||
| 112 | fast = _trans_BLm(fast); | ||
| 113 | } | ||
| 114 | |||
| 115 | for (i = m * 18; i < n; i++) | ||
| 116 | fast = _trans_FRm(fast); | ||
| 117 | |||
| 118 | return fast; | ||
| 119 | } | ||
| 120 | |||
| 121 | cube_t | ||
| 122 | run_compose(int64_t n) | ||
| 123 | { | ||
| 124 | cube_fast_t fast, cubes[RANDOMCUBES]; | ||
| 125 | int64_t i; | ||
| 126 | |||
| 127 | setup_randomcubes(cubes); | ||
| 128 | |||
| 129 | for (i = 0; i < n; i++) | ||
| 130 | fast = compose_fast(fast, cubes[i % RANDOMCUBES]); | ||
| 131 | |||
| 132 | return fast; | ||
| 133 | } | ||
| 134 | |||
| 135 | cube_t | ||
| 136 | run_inverse(int64_t n) | ||
| 137 | { | ||
| 138 | cube_fast_t fast, cubes[RANDOMCUBES]; | ||
| 139 | int64_t i; | ||
| 140 | |||
| 141 | setup_randomcubes(cubes); | ||
| 142 | |||
| 143 | for (i = 0; i < n; i++) | ||
| 144 | fast = inverse_fast(cubes[i % RANDOMCUBES]); | ||
| 145 | |||
| 146 | return fast; | ||
| 147 | } | ||
