Small Messages, Big Computations
We’ve talked theory; now for some measurements. In this section, we’ll perform two experiments. We’ll map two functions over a list of a hundred elements, and we’ll compare the time it takes with a parallel map vs. a sequential map.
We’ll use two different problem sets. The first computes this:
L = [L1, L2, ..., L100],
map(fun lists:sort/1, L)
Each of the elements in
L is a list of 1,000 random
The second computes this:
L = [27,27,..., 27],
map(fun ptests:fib/1, L)
L is a list of one hundred 27s, and we compute the
[fib(27), fib(27), ...] one hundred times.
fib is the Fibonacci function.)
We’ll time both these functions. Then we’ll replace
pmap and repeat the timings. ...