shlomif / fc-solve

Freecell Solver - a C library for automatically solving Freecell and some other variants of card Solitaire
https://fc-solve.shlomifish.org/
MIT License
60 stars 13 forks source link

[depth_dbm_freecell_solver] Implement extracted items batches of a user-specified size #7

Closed shlomif closed 7 years ago

shlomif commented 7 years ago

This is an attempt to improve the depth_dbm_fc_solver's multi-threading scalability which is currently very poor. In an attempt to reduce the amount of locking and increase CPU utilisation per thread, we want to:

  1. Define a --batch-size argument which can specify an arbitrarily large count of elements that each thread will extract from the queue at a time.

  2. In each thread, extract these items, and without locking: decode them, calculate their derived positions (segregated in an array per irreversible-move-depth). Then, lock the states collections and insert them all into the central depth collections. Repeat.

This is instead of extracting one item from the queue at a time.

Most of this should be done in https://github.com/shlomif/fc-solve/blob/master/fc-solve/source/depth_dbm_solver.c for now. Please use a new feature git branch.

shlomif commented 7 years ago

Implemented in commit a8bdd2b0259ece99337a30154eff0c75e309021d with some additional cleanups. Closing