Skip to content

Latest commit

 

History

History
32 lines (32 loc) · 1.6 KB

File metadata and controls

32 lines (32 loc) · 1.6 KB

Notes

Optimizations

Unrolling the main loop into macros

  • tested with N=12, L=18
  • for a chunk that contains a solution: -c 8 (solution is in -c 8 31)
  • the unrolled version is a little faster, 19.1s (e0354c1) vs 20.3s (65b1df3 + N/L adjustment)
  • I’ve tried profiling and optimizing both (the new version requires a change for the chunks: goto loop_4 for -c 8 and goto loop_5 for -c 8 31):

    make target/full-search-profile target/full-search-profile -c <chunk> xcrun llvm-profdata merge -output=default.profdata default.profraw make target/full-search-optimized

    time target/full-search-optimized -c 8

    hyperfine –warmup 5 ‘target/full-search -c 8 31’

  • results:
versionchunkwithout profilingwith profilingbetter than withoutbetter than rolled
65b1df3820.028 s19.865 s0.82%
65b1df38 31400.0 ms399.5 ms0.13%
e0354c1819.106 s18.714 s2.1%4.8%
e0354c18 31380.0 ms374.4 ms1.5%5.3%

Using uint8 instead of uint32 for seen and target_lookup

  • should be more cache friendly, appears to improve performance by ~1-2% for N=12
  • potentially has a slightly bigger impact for larger N, when the size of those arrays grows

full-search-16-22-v6

  • started at batch 1509