performance measurements

Each table row shows performance measurements for this F# Mono program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
120.530.5324,688515  0% 2% 2% 98%
162.232.2362,324515  1% 0% 0% 100%
2074.9775.07234,096515  1% 1% 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.

 notes

F# Compiler for F# 3.1 (Open Source Edition)

Mono JIT compiler version 3.10.1 (master/0083728 Thu Sep 11 09:57:48 PDT 2014)
LLVM: yes(3.4svn-mono-mono/e656cac)
GC: sgen

 binary-trees F# Mono #2 program source code

// The Computer Language Benchmarks Game

// http://benchmarksgame.alioth.debian.org/

//

// Minor modification by Don Syme & Jomo Fisher to use null as representation

// of Empty node.

// Based on F# version by Robert Pickering

// Based on ocaml version by Troestler Christophe & Isaac Gouy



[<CompilationRepresentation(CompilationRepresentationFlags
  .UseNullAsTrueValue)>]
type Tree<'T> = 

    | Empty 

    | Node of Tree<'T> * 'T * Tree<'T>

let rec make i d =
    if d = 0 then 
        Node(Empty, i, Empty)
    else
        let i2 = 2 * i
        let d = d - 1
        Node(make (i2 - 1) d, i, make i2 d)

let rec check x = 
    match x with 
    | Empty -> 0 
    | Node(l, i, r) -> i + check l - check r

let rec loopDepths maxDepth minDepth d =
    if d <= maxDepth then
        let niter = 1 <<< (maxDepth - d + minDepth)
        let mutable c = 0
        for i = 1 to niter do 
            c <- c + check (make i d) + check (make (-i) d)
        printf "%i\t trees of depth %i\t check: %i\n" (2 * niter) d c
        loopDepths maxDepth minDepth (d + 2)

[<EntryPoint>]
let main args =
    let minDepth = 4
    let maxDepth =
        let n = if args.Length > 0 then int args.[0] else 10
        max (minDepth + 2) n
    let stretchDepth = maxDepth + 1

    let c = check (make 0 stretchDepth)
    printf "stretch tree of depth %i\t check: %i\n" stretchDepth c
    let longLivedTree = make 0 maxDepth
    loopDepths maxDepth minDepth minDepth
    printf "long lived tree of depth %i\t check: %i\n" 
           maxDepth 
           (check longLivedTree)
    0

 make, command-line, and program output logs

Fri, 12 Sep 2014 01:03:56 GMT

MAKE:
mv binarytrees.fsharp-2.fsharp binarytrees.fsharp-2.fs
/usr/local/bin/fsharpc --target:exe --platform:x64 -O  -o binarytrees.fsharp-2.fsharp_run.exe binarytrees.fsharp-2.fs
F# Compiler for F# 3.1 (Open Source Edition)
Freely distributed under the Apache 2.0 Open Source License

/home/dunham/benchmarksgame_onecore/binarytrees/tmp/binarytrees.fsharp-2.fs(10,1): warning FS0221: The declarations in this file will be placed in an implicit module 'Binarytrees.fsharp-2' based on the file name 'binarytrees.fsharp-2.fs'. However this is not a valid F# identifier, so the contents will not be accessible from other files. Consider renaming the file or adding a 'module' or 'namespace' declaration at the top of the file.
rm binarytrees.fsharp-2.fs
4.02s to complete and log all make actions

COMMAND LINE:
/usr/local/bin/mono --llvm binarytrees.fsharp-2.fsharp_run.exe 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

Revised BSD license

  Home   Conclusions   License   Play