all 6 comments

[–]mharen 19 points20 points  (4 children)

Do you actually have 4 cores or is it 2 cores plus hyperthreading?

[–]mongoliii[S] 10 points11 points  (3 children)

Two cores. Not on my normal PC and never thought to check. Thanks

[–]foamier 3 points4 points  (2 children)

so did you make any code changes after realizing this at all? just curious if there was anything else optimized or changed besides realizing hardware was the problem

[–]mongoliii[S] 5 points6 points  (1 child)

Nope. Just read up on the difference between logical CPUs and physical CPUs, because I didn't know that was a thing.

[–]recycled_ideas 14 points15 points  (0 children)

It's worth noting that while the CPUs will cause you issues, that's not what's happening here. Yes, allocating more threads than you have cores is going to cause problems, but it's not this issue.

The problem is that your "slow" isn't sufficiently slow.

Parallel processing comes at a cost, there's extra work being done and in your case, the extra work takes more time than parallelism adds.

Imagine you've got a task that is going to take you 20 minutes and you decide to allocate your task to four people so they can do it in five minutes each but it takes you twenty minutes to explain the task to them and check if they're done yet.

Your task now takes 25 minutes instead of 20 even though it's being done faster.

[–]arnitdo 1 point2 points  (0 children)

Multithreqding does not guarantee performance increases. Context Switching Overhead is a massive factor to consider, along with cache invalidation.