So I've been playing around with threads in Java and I made a test. I made a program that makes around 10^9 multiplyings and then prints the milliseconds that were needed.
The program has 2 modes one of them does not print anything but just the milliseconds needed. The other mode however prints out "It's done" everytime a number is multiplied.
With the first mode the results are good with 1 thread I got result of 8270 ms and by the time I was using 8 threads I got result of 2237 ms (I'm testing on a 8 core computer).
With the second mode however the result with 1 thread was 94 054 ms and with 8 threads I got 96 430 ms.
My question is why the performance in the second mode is not better with 8 threads than with 1? I'm guessing it's something with that you can't print 2 things at the same time in the terminal so there is a que and that's the reason but that's just a guess.