/mobile Handheld Friendly website
x64 Ubuntu : Intel® Q6600® quad-core |
Each table row shows performance measurements for this OCaml program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|---|---|---|---|---|
| 1,000 | 0.14 | 0.08 | ? | 710 | 80% 88% 75% 88% |
| 4,000 | 3.51 | 0.94 | 5,556 | 710 | 98% 99% 98% 96% |
| 16,000 | 55.57 | 13.98 | 6,316 | 710 | 99% 100% 100% 100% |
Read the ↓ make, command line, and program output logs to see how this program was run.
Read mandelbrot benchmark to see what this program should do.
The OCaml native-code compiler, version 4.00.1
(* * The Computer Language Benchmarks Game * http://benchmarksgame.alioth.debian.org/ * * Contributed by Paolo Ribeca * * (Very loosely based on previous version Ocaml #3, * which had been contributed by * Christophe TROESTLER * and enhanced by * Christian Szegedy and Yaron Minsky) *) let niter = 50 let limit = 4. let workers = 64 let worker w h_lo h_hi = let buf = String.create ((w / 8 + (if w mod 8 > 0 then 1 else 0)) * (h_hi - h_lo)) and ptr = ref 0 in let fw = float w /. 2. in let fh = fw in let red_w = w - 1 and red_h_hi = h_hi - 1 and byte = ref 0 in for y = h_lo to red_h_hi do let ci = float y /. fh -. 1. in for x = 0 to red_w do let cr = float x /. fw -. 1.5 and zr = ref 0. and zi = ref 0. and trmti = ref 0. and n = ref 0 in begin try while true do zi := 2. *. !zr *. !zi +. ci; zr := !trmti +. cr; let tr = !zr *. !zr and ti = !zi *. !zi in if tr +. ti > limit then begin byte := !byte lsl 1; raise Exit end else if incr n; !n = niter then begin byte := (!byte lsl 1) lor 0x01; raise Exit end else trmti := tr -. ti done with Exit -> () end; if x mod 8 = 7 then begin buf.[!ptr] <- (Char.chr !byte); incr ptr; byte := 0 end done; let rem = w mod 8 in if rem != 0 then begin buf.[!ptr] <- (Char.chr (!byte lsl (8 - rem))); incr ptr; byte := 0 end done; buf let _ = let w = int_of_string (Array.get Sys.argv 1) in let rows = w / workers and rem = w mod workers in Printf.printf "P4\n%i %i\n%!" w w; let rec spawn i = if i > 0 then let red_i = i - 1 in match Unix.fork () with | 0 -> spawn red_i | pid -> let buf = worker w (red_i * rows + min red_i rem) (i * rows + min i rem) in match Unix.waitpid [] pid with | _, Unix.WEXITED 0 -> Printf.printf "%s%!" buf; exit 0 | _ -> assert false else exit 0 in spawn workers
Sat, 02 Feb 2013 20:45:53 GMT MAKE: mv mandelbrot.ocaml mandelbrot.ml /usr/local/bin/ocamlopt -noassert -unsafe -fno-PIC -nodynlink -inline 100 unix.cmxa mandelbrot.ml -o mandelbrot.ocaml_run rm mandelbrot.ml 0.27s to complete and log all make actions COMMAND LINE: ./mandelbrot.ocaml_run 16000 (BINARY) PROGRAM OUTPUT NOT SHOWN