lindorffs / voidgen

1 stars 0 forks source link

Parallelize Loops. #5

Closed lindorffs closed 3 months ago

lindorffs commented 3 months ago

The update and render functions are called linearly. This can lead to awkward performance issues.

Perhaps threading the update loop out to another thread is a good idea.

lindorffs commented 3 months ago

The testing branch has a commit now that has this working. Input needs to be reworked to use mutexes to ensure input is passed to the update loop properly.

As a side-note, this does improve performance significantly, allowing my laptop to play and record with little to no impact on the recording or gameplay. With a typical gaming computer, the non-parallel version would theoretically be fine in most cases, including recording. Now, so is a laptop like my. Once mutexes are implemented for input, this improvement will be even greater.

Another improvement is in a situation where the update function stalls for a long period of time, as in Voidgen-Chess when the UCI engine is determining a move. These delays would impact window event handling, including input and window closing. With the update loop separated from where events are handled, this will no longer happen.