I have a scrabble algorithm which looks basically like this.
These 4 routines must be sequentially executed.
for (Board.ALL_SQUARES) |square| self.gen(board, square, NORMAL, .Horizontal);
for (Board.ALL_SQUARES) |square| self.gen(board, square, NORMAL, .Vertical);
for (Board.ALL_SQUARES) |square| self.gen(board, square, CROSSWORDS, .Horizontal);
for (Board.ALL_SQUARES) |square| self.gen(board, square, CROSSWORDS, .Vertical);
Inside the generator are some square-info write things going on during gen
.
The board is not touched and only read from.
And then I have the “global” movelist which is written to with each move found.
I never seriously worked with parallel threads but I would like to give it a try.
I was wondering: when processing horizontal or vertical the 15 rows the results are completely independent of eachother. Would that be a good candidate idea for using threads per row / column? Would it actually speed up things?
If so, are there some basic thread tips people have here?
The only thing I really know is that threads must not write in parallel to the same memory area.