Creating threads is really computationally expensive. The OS does a lot of work that you’re not seeing directly. This is why most multi threaded applications use something called a thread pool where worker threads are already created and just waiting to be assigned work.
In your case you should create a thread pool on program startup and then feed it the matrix calculations as jobs to do. And it’s not going to be particularly useful unless you plan on doing a lot of calculations.
Other thing to keep in mind is that your dual core and hyperthreaded CPU has quirks that impact performance. Dual core means it has 2 hardware threads, which means the CPU can actually do 2 things concurrently. But hyperthreaded semi-doubles it and lets you do 4 things at once. It semi-doubles it because hyperthreaded cores act like 2 cores but the 2 cores share some parts. One of those parts is the ALU which does the actual computation. In your case you’re doing arithmetic with RAM so it’s very likely that hyperthreading actually slows you down.
Latest Answers