-
-
Save opqdonut/a8fd622f4adf576b9c4e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Parallel.Strategies | |
factorial :: Integer -> Integer | |
factorial n = product [1..n] | |
f = length . show . factorial | |
main = print result | |
where result = map f [n+100,n+99..n] `using` parList rseq | |
n = 50*1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% time ./par +RTS -N1 -s | |
[213707,213702,213698,213693,213688,213683,213679,213674,213669,213665,213660,213655,213651,213646,213641,213636,213632,213627,213622,213618,213613,213608,213604,213599,213594,213589,213585,213580,213575,213571,213566,213561,213557,213552,213547,213542,213538,213533,213528,213524,213519,213514,213510,213505,213500,213495,213491,213486,213481,213477,213472,213467,213463,213458,213453,213448,213444,213439,213434,213430,213425,213420,213416,213411,213406,213401,213397,213392,213387,213383,213378,213373,213369,213364,213359,213355,213350,213345,213340,213336,213331,213326,213322,213317,213312,213308,213303,213298,213293,213289,213284,213279,213275,213270,213265,213261,213256,213251,213246,213242,213237] | |
214,611,642,704 bytes allocated in the heap | |
245,282,728 bytes copied during GC | |
255,064 bytes maximum residency (60 sample(s)) | |
71,832 bytes maximum slop | |
3 MB total memory in use (0 MB lost due to fragmentation) | |
Tot time (elapsed) Avg pause Max pause | |
Gen 0 386796 colls, 0 par 1.83s 1.77s 0.0000s 0.0001s | |
Gen 1 60 colls, 0 par 0.01s 0.01s 0.0001s 0.0002s | |
TASKS: 4 (1 bound, 3 peak workers (3 total), using -N1) | |
SPARKS: 101 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 101 fizzled) | |
INIT time 0.00s ( 0.00s elapsed) | |
MUT time 27.71s ( 27.73s elapsed) | |
GC time 1.83s ( 1.78s elapsed) | |
EXIT time 0.00s ( 0.00s elapsed) | |
Total time 29.54s ( 29.51s elapsed) | |
Alloc rate 7,746,213,572 bytes per MUT second | |
Productivity 93.8% of total user, 93.9% of total elapsed | |
gc_alloc_block_sync: 0 | |
whitehole_spin: 0 | |
gen[0].sync: 0 | |
gen[1].sync: 0 | |
./par +RTS -N1 -s 28.99s user 0.54s system 100% cpu 29.510 total | |
% time ./par +RTS -N2 -s | |
[213707,213702,213698,213693,213688,213683,213679,213674,213669,213665,213660,213655,213651,213646,213641,213636,213632,213627,213622,213618,213613,213608,213604,213599,213594,213589,213585,213580,213575,213571,213566,213561,213557,213552,213547,213542,213538,213533,213528,213524,213519,213514,213510,213505,213500,213495,213491,213486,213481,213477,213472,213467,213463,213458,213453,213448,213444,213439,213434,213430,213425,213420,213416,213411,213406,213401,213397,213392,213387,213383,213378,213373,213369,213364,213359,213355,213350,213345,213340,213336,213331,213326,213322,213317,213312,213308,213303,213298,213293,213289,213284,213279,213275,213270,213265,213261,213256,213251,213246,213242,213237] | |
214,611,713,384 bytes allocated in the heap | |
680,277,352 bytes copied during GC | |
585,880 bytes maximum residency (304 sample(s)) | |
76,328 bytes maximum slop | |
5 MB total memory in use (1 MB lost due to fragmentation) | |
Tot time (elapsed) Avg pause Max pause | |
Gen 0 379447 colls, 379447 par 6.10s 3.03s 0.0000s 0.0005s | |
Gen 1 304 colls, 303 par 0.05s 0.03s 0.0001s 0.0002s | |
Parallel GC work balance: 7.58% (serial 0%, perfect 100%) | |
TASKS: 6 (1 bound, 5 peak workers (5 total), using -N2) | |
SPARKS: 101 (100 converted, 0 overflowed, 0 dud, 0 GC'd, 1 fizzled) | |
INIT time 0.00s ( 0.00s elapsed) | |
MUT time 45.66s ( 22.95s elapsed) | |
GC time 6.15s ( 3.06s elapsed) | |
EXIT time 0.00s ( 0.00s elapsed) | |
Total time 51.82s ( 26.01s elapsed) | |
Alloc rate 4,700,029,289 bytes per MUT second | |
Productivity 88.1% of total user, 175.6% of total elapsed | |
gc_alloc_block_sync: 6932 | |
whitehole_spin: 0 | |
gen[0].sync: 32763 | |
gen[1].sync: 53 | |
./par +RTS -N2 -s 47.58s user 4.24s system 199% cpu 26.013 total | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Parallel | |
factorial :: Integer -> Integer | |
factorial n = product [1..n] | |
f = length . show . factorial | |
main = print result | |
where result = a `par` b `pseq` (a+b) | |
n = 150*1000 | |
a = f n | |
b = f n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% ./par2 +RTS -s | |
1422546 | |
42,417,819,472 bytes allocated in the heap | |
43,692,272 bytes copied during GC | |
858,768 bytes maximum residency (8 sample(s)) | |
72,880 bytes maximum slop | |
6 MB total memory in use (1 MB lost due to fragmentation) | |
Tot time (elapsed) Avg pause Max pause | |
Gen 0 69761 colls, 0 par 0.29s 0.28s 0.0000s 0.0010s | |
Gen 1 8 colls, 0 par 0.00s 0.00s 0.0001s 0.0002s | |
TASKS: 4 (1 bound, 3 peak workers (3 total), using -N1) | |
SPARKS: 1 (0 converted, 0 overflowed, 0 dud, 1 GC'd, 0 fizzled) | |
INIT time 0.00s ( 0.00s elapsed) | |
MUT time 5.28s ( 5.29s elapsed) | |
GC time 0.29s ( 0.28s elapsed) | |
EXIT time 0.00s ( 0.00s elapsed) | |
Total time 5.57s ( 5.57s elapsed) | |
Alloc rate 8,030,303,884 bytes per MUT second | |
Productivity 94.8% of total user, 94.9% of total elapsed | |
gc_alloc_block_sync: 0 | |
whitehole_spin: 0 | |
gen[0].sync: 0 | |
gen[1].sync: 0 | |
% ./par2 +RTS -s -N2 | |
1422546 | |
42,417,832,488 bytes allocated in the heap | |
80,082,040 bytes copied during GC | |
868,792 bytes maximum residency (8 sample(s)) | |
88,168 bytes maximum slop | |
7 MB total memory in use (1 MB lost due to fragmentation) | |
Tot time (elapsed) Avg pause Max pause | |
Gen 0 69761 colls, 69761 par 0.79s 0.38s 0.0000s 0.0008s | |
Gen 1 8 colls, 7 par 0.00s 0.00s 0.0001s 0.0001s | |
Parallel GC work balance: 2.30% (serial 0%, perfect 100%) | |
TASKS: 6 (1 bound, 5 peak workers (5 total), using -N2) | |
SPARKS: 1 (0 converted, 0 overflowed, 0 dud, 1 GC'd, 0 fizzled) | |
INIT time 0.00s ( 0.00s elapsed) | |
MUT time 6.24s ( 5.95s elapsed) | |
GC time 0.79s ( 0.38s elapsed) | |
EXIT time 0.00s ( 0.00s elapsed) | |
Total time 7.04s ( 6.33s elapsed) | |
Alloc rate 6,797,502,905 bytes per MUT second | |
Productivity 88.7% of total user, 98.5% of total elapsed | |
gc_alloc_block_sync: 412 | |
whitehole_spin: 0 | |
gen[0].sync: 0 | |
gen[1].sync: 0 | |
% ./par2 +RTS -s -N3 | |
1422546 | |
42,417,848,664 bytes allocated in the heap | |
79,581,592 bytes copied during GC | |
882,336 bytes maximum residency (8 sample(s)) | |
92,400 bytes maximum slop | |
7 MB total memory in use (1 MB lost due to fragmentation) | |
Tot time (elapsed) Avg pause Max pause | |
Gen 0 69761 colls, 69761 par 1.52s 0.51s 0.0000s 0.0040s | |
Gen 1 8 colls, 7 par 0.00s 0.00s 0.0001s 0.0001s | |
Parallel GC work balance: 2.14% (serial 0%, perfect 100%) | |
TASKS: 8 (1 bound, 7 peak workers (7 total), using -N3) | |
SPARKS: 1 (0 converted, 0 overflowed, 0 dud, 1 GC'd, 0 fizzled) | |
INIT time 0.00s ( 0.00s elapsed) | |
MUT time 7.04s ( 6.20s elapsed) | |
GC time 1.52s ( 0.51s elapsed) | |
EXIT time 0.00s ( 0.00s elapsed) | |
Total time 8.57s ( 6.71s elapsed) | |
Alloc rate 6,022,011,173 bytes per MUT second | |
Productivity 82.2% of total user, 104.9% of total elapsed | |
gc_alloc_block_sync: 4716 | |
whitehole_spin: 0 | |
gen[0].sync: 2 | |
gen[1].sync: 0 | |
% ./par2 +RTS -s -N4 | |
1422546 | |
42,417,862,824 bytes allocated in the heap | |
130,243,048 bytes copied during GC | |
1,646,496 bytes maximum residency (17 sample(s)) | |
103,656 bytes maximum slop | |
57 MB total memory in use (48 MB lost due to fragmentation) | |
Tot time (elapsed) Avg pause Max pause | |
Gen 0 67070 colls, 67070 par 3.10s 0.82s 0.0000s 0.0083s | |
Gen 1 17 colls, 16 par 0.03s 0.01s 0.0005s 0.0037s | |
Parallel GC work balance: 12.64% (serial 0%, perfect 100%) | |
TASKS: 10 (1 bound, 9 peak workers (9 total), using -N4) | |
SPARKS: 1 (1 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled) | |
INIT time 0.00s ( 0.00s elapsed) | |
MUT time 11.13s ( 4.19s elapsed) | |
GC time 3.13s ( 0.82s elapsed) | |
EXIT time 0.00s ( 0.00s elapsed) | |
Total time 14.26s ( 5.02s elapsed) | |
Alloc rate 3,811,418,874 bytes per MUT second | |
Productivity 78.0% of total user, 221.9% of total elapsed | |
gc_alloc_block_sync: 96708 | |
whitehole_spin: 0 | |
gen[0].sync: 54147 | |
gen[1].sync: 34 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment