News for hackers. Stuff that matters.
Re:Parallelism in Crystal by aidenn0 on Friday September 06, 2019 @07:51PM (#20900877)
I get why N=2 is slower than single-threaded, but why is N=4 more than twice as fast as N=2?
Re:Parallelism in Crystal by ricardobeat on Friday September 06, 2019 @08:39PM (#20901061)
If you're looking at the first graph, the explanation is right above - the overhead of synchronization.
Re:Parallelism in Crystal by aidenn0 on Friday September 06, 2019 @11:03PM (#20901514)
That's nonsensical. There is surely at least as much synchronization overhead with 4 threads as with 2.
Re:Parallelism in Crystal by jonesetc on Friday September 06, 2019 @11:16PM (#20901565)
If the overhead is X, and the amount of work that can be done ignoring it is Y, you have Y - X. If you double the amount of work that can be down, but overhead stays the same you have 2Y - X, which is more than 2(Y - X) = 2Y - 2X. You're over performing doubling by not having to double the synchronization cost.
Re:Parallelism in Crystal by paulddraper on Saturday September 07, 2019 @12:09AM (#20901730)
Not necessarily.

There can be overhead introduced between the "1 thread" and ">1 thread" cases.

Re:Parallelism in Crystal by ricardobeat on Saturday September 07, 2019 @12:21PM (#20904740)
From 1 -> 2 threads the overhead is introduced, if the cost is somewhat fixed, the gains from 2 -> 4 can be proportionally larger.