Multi threading off then on

Subscribers:
1,270
Published on ● Video Link: https://www.youtube.com/watch?v=1067q5C1SVc



Duration: 1:40
840 views
26


I'm using Win32 SYNCHRONIZATION_BARRIER objects that block a thread's execution until I need it. So I can spawn some worker threads to divide up the work of finding the first collision time. This gives a substantial performance boost over trying to find the first collision time in a single thread. The worker threads wait at the SYNCHRONIZATION_BARRIER until the main thread is ready for them.

In the video, the first run is a single thread. the update time approaches 80ms. Then I switch to 12 threads and the update time is around 20 ms. Not bad considering there are 360 balls doing a bad n^2 algorithm. I want to eventually do spatial partitioning, like BVH.

I'm also looking for more places I can implement multi threading instead of it only being used to find collision results.

The code is only updating one ball at a time to have perfect accuracy, thats why it gets so slow with only a relatively low amount of balls.