Page 1 of 1

Multithreading benchmarks

Posted: April 19th, 2019, 2:34 pm
by cyboryxmen
I have made a repository that contains a collection of projects that benchmark high performance multithreaded implementations of common algorithms. It's a CMake project that compiles both the serial and concurrent versions of the project.

Right now, I have only managed to upload a project that benchmarks the filter algorithm. The algorithm simply copies elements from one array to another if the element meets a cetain condition. In this case, it checks numbers from the array to see if it is below a certain threshold and copies it over if so.

The multithreaded implementation is pretty basic as far as high performance multithreaded code go. I ran it on my quad core hyperthreaded i7 and the results are quite satisfying. It helps to show the capabilities of multithreading and its potential in the future as we get more and more cores in our CPUs. Hopefully it manages to run as well on your CPU as it did on mine. It should work even if you have a single core CPU but really, what's the point of running this on a CPU like that.

I'll upload the merge sort and quick sort project once I'm done optimizing them.

Re: Multithreading benchmarks

Posted: April 19th, 2019, 8:03 pm
by BobsCrabShack
Im curious how this would compare using reduce with copy_if and back_inserter into a reserved vector. Or for sorting sort. The c++ 17 versions have an execution policy parameter that you can specify multithreaded.

Re: Multithreading benchmarks

Posted: April 20th, 2019, 7:20 am
by chili
Am I losing my mfing mind

I swear I posted last night about std::copy_if and execution policy.

Re: Multithreading benchmarks

Posted: April 20th, 2019, 10:16 am
by albinopapa
@chili, Maybe you posted it to discord?

Re: Multithreading benchmarks

Posted: April 22nd, 2019, 2:17 am
by chili
Nah, twas on this thread. But must not have hit submit or something.

Re: Multithreading benchmarks

Posted: April 22nd, 2019, 8:15 am
by cyboryxmen
I added another executable to the build to benchmark the STL. It only preformed slightly better than the basic serial algorithm. Also, the debugger shows that no additional threads were launched when executing. Maybe Visual Studio doesn't support it? 🤷