Second attempt: trying to avoid redundant checking of paths. Compress board states to 64-bit number and then hash it. Check for board equivalence using rotational and mirrored symmetry... it still isn't fast enough.
just starting to look at it again, so no big changes.