Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
time profiling and nested function inlining
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-12-07 (10:43)
From: Quôc_Peyrot <chojin@l...>
Subject: Re: [Caml-list] time profiling and nested function inlining

On Dec 6, 2006, at 12:55 AM, Daniel Bünzli wrote:

> If you have the development tools installed, you can profile on  
> macosx using shark (you don't even need to compile with -p). Invoke  
> it from the command line on your executable as follows:
> > shark -i -1 -q ./yourexec.opt args
> This will write a .mshark file in the directory that you can open  
> with
> > open *.mshark

Thanks, it worked like a charm.

Anyone for my second question from my original email (about the  
nested function)?

The more I look at the assembly output, the more I am puzzled.  
Another simple example:

for i = 0 to len - 1 do
   for j = 0 to len - 1 do
     array.(i).(j) <- 0;

doesn't seem to be equivalent to

for i = 0 to len - 1 do
   let array_i = array.(i) in
   for j = 0 to len - 1 do
     array_i.(j) <- 0;

in the former,  the compiler doesn't detect the invariant "array.(i)"  
and keeps it inside the inner loop.
I tried to pass -ccopt -O3 to ocamlopt but it didn't seem to change  

Best Regards,