/mobile Handheld Friendly website
Ubuntu : Intel® Q6600® one core |
Each table row shows performance measurements for this Erlang HiPE program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|---|---|---|---|---|
| 12 | 0.20 | 0.23 | 288 | 499 | 9% 0% 4% 91% |
| 16 | 1.86 | 1.87 | 34,904 | 499 | 2% 0% 1% 100% |
| 20 | 47.57 | 47.63 | 338,644 | 499 | 0% 0% 0% 100% |
Read the ↓ make, command line, and program output logs to see how this program was run.
Read binary-trees benchmark to see what this program should do.
Erlang R16B (erts-5.10.1) [source] [async-threads:10] [hipe] [kernel-poll:false]
% The Computer Language Benchmarks Game % http://benchmarksgame.alioth.debian.org/ % % contributed by Isaac Gouy (Erlang novice) % parallelized by Kevin Scaldeferri -module(binarytrees). -export([main/1]). -export([depth/2]). -define(Min,4). main([Arg]) -> N = list_to_integer(Arg), Max = lists:max([?Min+2,N]), Stretch = Max + 1, io:fwrite("stretch tree of depth ~w\t check: ~w~n", [ Stretch, itemCheck(bottomUp(0,Stretch)) ]), LongLivedTree = bottomUp(0,Max), depthLoop(?Min,Max), io:fwrite("long lived tree of depth ~w\t check: ~w~n", [ Max, itemCheck(LongLivedTree) ]), halt(0). depthLoop(D,M) -> Results = rpc:pmap({?MODULE, depth}, [M], lists:seq(D, M, 2)), lists:foreach(fun(Result) -> io:fwrite("~w\t trees of depth ~w\t check: ~w~n", Result) end, Results). depth(D,M) -> N = 1 bsl (M-D + ?Min), [ 2*N, D, sumLoop(N,D,0) ]. sumLoop(0,_,Sum) -> Sum; sumLoop(N,D,Sum) -> sumLoop(N-1,D, Sum + itemCheck(bottomUp(N,D)) + itemCheck(bottomUp(-1*N,D))). bottomUp(I,0) -> {I, nil, nil}; bottomUp(I,D) -> {I, bottomUp(2*I-1,D-1), bottomUp(2*I,D-1)}. itemCheck(nil) -> 0; itemCheck({I,Left,Right}) -> I + itemCheck(Left) - itemCheck(Right).
Mon, 04 Mar 2013 21:35:25 GMT
MAKE:
mv binarytrees.hipe-2.hipe binarytrees.erl
/usr/local/src/otp_src_R16B_nosmp/bin/erlc +native +"{hipe, [o3]}" binarytrees.erl
0.62s to complete and log all make actions
COMMAND LINE:
/usr/local/src/otp_src_R16B_nosmp/bin/erl -smp disable -noshell -run binarytrees main 20
PROGRAM OUTPUT:
stretch tree of depth 21 check: -1
2097152 trees of depth 4 check: -2097152
524288 trees of depth 6 check: -524288
131072 trees of depth 8 check: -131072
32768 trees of depth 10 check: -32768
8192 trees of depth 12 check: -8192
2048 trees of depth 14 check: -2048
512 trees of depth 16 check: -512
128 trees of depth 18 check: -128
32 trees of depth 20 check: -32
long lived tree of depth 20 check: -1