/mobile Handheld Friendly website

 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.290.23584565  83% 13% 21% 25%
163.712.3030,488565  23% 40% 71% 30%
2078.0048.09245,164565  75% 21% 27% 40%

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

Microsoft (R) F# 3.0 Compiler version (Mono build)

Mono JIT compiler version 3.0.3 (tarball Tue Feb 12 21:22:20 PST 2013)
LLVM: yes(3.2svn-mono)

 binary-trees F# Mono #3 program source code

// The Computer Language Benchmarks Game

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

//

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

// of Empty node and to use a single Next element.

// Based on F# version by Robert Pickering

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


open System
open Unchecked

type Next = { Left: Tree; Right: Tree }
and [<Struct>] Tree(next:Next,item:int) =
    member t.Check() =
        match box next with 
        | null -> item
        | _ -> item + next.Left.Check() - next.Right.Check()

let rec make item depth =
    if depth > 0 then Tree({Left = make (2*item-1) (depth-1); Right=make (2*item) (depth-1)}, item)
    else Tree(defaultof<_>,item)

let inline check (tree:Tree) = tree.Check()

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)
        Console.WriteLine("{0}\t trees of depth {1}\t check: {2}",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)
    Console.WriteLine("stretch tree of depth {0}\t check: {1}",stretchDepth,c)
    let longLivedTree = make 0 maxDepth
    loopDepths maxDepth minDepth minDepth
    Console.WriteLine("long lived tree of depth {0}\t check: {1}",maxDepth,(check longLivedTree))
    exit 0

 make, command-line, and program output logs

Wed, 13 Feb 2013 06:31:03 GMT

MAKE:
mv binarytrees.fsharp-3.fsharp binarytrees.fsharp-3.fs
/usr/local/bin/fsharpc --target:exe --platform:x64 -O  -o binarytrees.fsharp-3.fsharp_run.exe binarytrees.fsharp-3.fs
Microsoft (R) F# 3.0 Compiler version (Mono build)
Copyright (c) Microsoft Corporation. All Rights Reserved.

/home/dunham/benchmarksgame_quadcore/binarytrees/tmp/binarytrees.fsharp-3.fs(9,1): warning FS0221: The declarations in this file will be placed in an implicit module 'Binarytrees.fsharp-3' based on the file name 'binarytrees.fsharp-3.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-3.fs
4.23s to complete and log all make actions

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

<premain>: CommandLine Error: Argument 'misched' defined more than once!
<premain>: CommandLine Error: Argument 'print-machineinstrs' defined more than once!
-simplifycfg: CommandLine Error: Argument 'misched' defined more than once!
-simplifycfg: CommandLine Error: Argument 'print-machineinstrs' defined more than once!

Revised BSD license

  Home   Conclusions   License   Play