Hi,
I am reading "Choosing the Right Runtime" section of the "Real World Haskell" book, and having a question.
There are typically four cases as follows:
case # |
code |
linking |
RTS -N |
1 |
sequential |
non-threaded |
1 |
2 |
concurrent/parallel |
non-threaded |
1 |
3 |
concurrent/parallel |
threaded |
1 |
4 |
concurrent/parallel |
threaded |
> 1 |
Case #4 may or may not be faster than #3. But #3 is definitely slower than #1 and #2, due to overhead from threaded runtime lib.
Now my question is, how does #2 compare with #1? (#2 must make sense, otherwise it would not be an option, and the book authors would not have specifically talked about it in one section.) Are the authors implying #2 may be potentially much faster than #1? If there were no such potential, one would just write sequential codes without attempting concurrent/parallel style, under the circumstances where his job is limited to one core.
Thanks,
Hong