aboutsummaryrefslogtreecommitdiff
path: root/src/solve_h48.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-07-21 00:03:47 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-07-21 00:03:47 +0200
commit151eb26baf355d3c5dcedf8cd0671b02e1004095 (patch)
tree663c3191722838a241377cafc93bd8ef7a02645b /src/solve_h48.h
parentf64a5a67a37015bd5066efd9b1edb6ac3e0b7a97 (diff)
downloadnissy-core-151eb26baf355d3c5dcedf8cd0671b02e1004095.tar.gz
nissy-core-151eb26baf355d3c5dcedf8cd0671b02e1004095.zip
Tiny performance gains
Diffstat (limited to 'src/solve_h48.h')
-rw-r--r--src/solve_h48.h27
1 files changed, 6 insertions, 21 deletions
diff --git a/src/solve_h48.h b/src/solve_h48.h
index ad865a7..1701268 100644
--- a/src/solve_h48.h
+++ b/src/solve_h48.h
@@ -35,13 +35,14 @@ _t by _ttrep).
35#define _foreach_h48sim(_cube, _cocsepdata, _selfsim, _h, _action) \ 35#define _foreach_h48sim(_cube, _cocsepdata, _selfsim, _h, _action) \
36 int64_t _cocsep = coord_cocsep(_cube); \ 36 int64_t _cocsep = coord_cocsep(_cube); \
37 uint8_t _ttrep = TTREP(_cocsepdata[_cocsep]); \ 37 uint8_t _ttrep = TTREP(_cocsepdata[_cocsep]); \
38 uint8_t _inverse_ttrep = inverse_trans(_ttrep); \
38 int64_t _coclass = COCLASS(_cocsepdata[_cocsep]); \ 39 int64_t _coclass = COCLASS(_cocsepdata[_cocsep]); \
39 cube_t _rep = transform(_cube, _ttrep); \ 40 cube_t _rep = transform(_cube, _ttrep); \
40 uint64_t _sim = _selfsim[_coclass]; \ 41 uint64_t _sim = _selfsim[_coclass]; \
41 for (uint8_t _t = 0; _t < 48 && _sim; _t++, _sim >>= 1) { \ 42 for (uint8_t _t = 0; _t < 48 && _sim; _t++, _sim >>= 1) { \
42 if (!(_sim & 1)) continue; \ 43 if (!(_sim & 1)) continue; \
43 _cube = transform(_rep, _t); \ 44 _cube = transform(_rep, _t); \
44 _cube = transform(_cube, inverse_trans(_ttrep)); \ 45 _cube = transform(_cube, _inverse_ttrep); \
45 _action \ 46 _action \
46 } 47 }
47 48
@@ -512,7 +513,9 @@ gendata_h48h0k4_return_size:
512_static int64_t 513_static int64_t
513gendata_h48h0k4_bfs(bfsarg_esep_t *arg) 514gendata_h48h0k4_bfs(bfsarg_esep_t *arg)
514{ 515{
515 if (2 * arg->done < (int64_t)ESEP_MAX(0)) 516 const uint8_t breakpoint = 10; /* Hand-picked optimal */
517
518 if (arg->depth < breakpoint)
516 return gendata_h48h0k4_bfs_fromdone(arg); 519 return gendata_h48h0k4_bfs_fromdone(arg);
517 else 520 else
518 return gendata_h48h0k4_bfs_fromnew(arg); 521 return gendata_h48h0k4_bfs_fromnew(arg);
@@ -567,31 +570,13 @@ gendata_h48h0k4_bfs_fromnew(bfsarg_esep_t *arg)
567 x = get_esep_pval(arg->buf32, j); 570 x = get_esep_pval(arg->buf32, j);
568 if (x >= arg->depth) 571 if (x >= arg->depth)
569 continue; 572 continue;
570#if 0
571 cube_t transd;
572 int64_t t, cocsep_coord, sim;
573
574 set_esep_pval(arg->buf32, i, arg->depth);
575 cc++;
576 cocsep_coord = i / H48_ESIZE(0);
577 sim = arg->selfsim[cocsep_coord] >> 1;
578 for (t = 1; t < 48 && sim; t++) {
579 transd = transform(cube, t);
580 j = coord_h48(transd, arg->cocsepdata, 0);
581 x = get_esep_pval(arg->buf32, j);
582 set_esep_pval(arg->buf32, j, arg->depth);
583 cc += x == 0xF;
584 }
585#else
586 _foreach_h48sim(cube, arg->cocsepdata, arg->selfsim, 0, 573 _foreach_h48sim(cube, arg->cocsepdata, arg->selfsim, 0,
587 j = coord_h48(cube, arg->cocsepdata, 0); 574 j = coord_h48(cube, arg->cocsepdata, 0);
588 x = get_esep_pval(arg->buf32, j); 575 x = get_esep_pval(arg->buf32, j);
589 set_esep_pval(arg->buf32, j, arg->depth); 576 set_esep_pval(arg->buf32, j, arg->depth);
590 cc += x == 0xF; 577 cc += x == 0xF;
591 ) 578 )
592#endif 579 break; /* Enough to find one, skip the rest */
593
594 break;
595 } 580 }
596 } 581 }
597 582

Generated with cgit - Back to sebastiano.tronto.net