September 2013
Intermediate to advanced
548 pages
12h 25m
English
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
integers.
The second computes this:
| | L = [27,27,..., 27], |
| | map(fun ptests:fib/1, L) |
Here, L is a list of one hundred 27s, and we compute the
list [fib(27), fib(27), ...] one hundred times.
(fib is the Fibonacci function.)
We’ll time both these functions. Then we’ll replace map with
pmap and repeat the timings. ...
Read now
Unlock full access