Tuesday, March 28, 2017

Asio ThreadPool Performance Test

Updated: 7 April 2017

Category: C++, Concurrency Programming, Thread pool, Asio

I have tested Asio ThreadPool performance by comparing processing time of three concurrency methods. The first method is Standard C++ Multithreading (mthread), the second is Asio ThreadPool (asio) and the last is Microsoft Parallel Patterns Library (ppl). All of them were used for calculating PI and Fibonacci numbers on the same machine for both Windows and Linux. They all used the same code except for PPL that is only available on Windows. I have also measured serial processing times for baseline comparison. The C++ compilers used are MSVC 19.10.25017 for Windows, GCC 6.3.1 and Clang 3.9.1 for Linux. The results are as follow:

Comparing time used between MSVC, GCC and Clang

GCC is the fastest in all scenarios (not including ppl). The second is MSVC except for fibonacci with asio that Clang comes the second.

Comparing each concurrency method with serial processing

Using MSVC
There is no big difference in time used for PI among mthread, asio and ppl. However for Fabonacci, mthread and ppl approximately process at the same speed and faster than asio which is the slowest.

Using GCC
There is no big difference between mthread and asio in time used for PI. But for Fabonacci, mthread has a little bit faster than asio.

Using Clang
There is no big difference between mthread and asio for both PI and Fibonacci.

  • The concurrency processing speed depends mainly on three factors: compiler, computational type and concurrency method respectively. 
  • Asio ThreadPool does not perform well with MSVC on some computational type (Fibonacci) when comparing with GCC and Clang.
The code is here.

No comments:

Post a Comment