Version française
Home     About     Download     Resources     Contact us    
Browse thread
Memory allocation nano-benchmark.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Memory allocation nano-benchmark.
On Fri, 2005-02-11 at 03:36, Frédéric Gava wrote:
> Hi,
> 
> > let test tablesize =
> >   let table =
> >     Array.init tablesize (fun i ->
> >     Array.init tablesize (fun j ->
> >     Array.create tablesize 0))
> >   in
> >     for i = 0 to tablesize - 1 do
> >     for j = 0 to tablesize - 1 do
> >     for k = 0 to tablesize - 1 do
> >     table.(i).(j).(k) <- (i+1)*(j+1)*(k+1)
> >     done done done
> Here, you have tablesize^2 applications and time to create the closure(s),
> so it is not a good example.

Why? o(2) is lots smaller than o(3). In my test case,
a factor of 250 should show up in the timings.

I also assumed, naively, Ocaml would use invariant
code motion to optimise the triple indexing.


> > [skaller@pelican] ~>time ./xmem 250
> > real    0m3.327s
> > user    0m2.760s
> > sys     0m0.300s
> I do not understand what is "xmem". A super hero ;-) ?

LOL! It's just the name of the program. The original one
was 'mem' the modified one I called 'xmem'.

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net