Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] interesting array efficiency observations
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: briand@a...
Subject: [Caml-list] interesting array efficiency observations

I was investigating the use of 1-D bigarray's vs Array and noticed
 that the 1-D bigarray using c_layout seems to be slower than Array.

Is this an expected result ?

Thanks


Brian

------------------------------------------------------------

let n = 10000 in
let a = Array.create n 2. in
  for i = 0 to n-1 do
    for j = 0 to n-1 do
      a.(j) <- sqrt(a.(j) *. a.(j));
    done;
  done;

------------------------------------------------------------

(* #load "bigarray.cma";;*)

(* test file for big arrays. *)

(* #load "bigarray.cma";; *)

let n = 10000 in
let a = Bigarray.Array1.create Bigarray.float64 Bigarray.c_layout n in

  for i = 0 to n-1 do
    for j =0 to n-1 do
      a.{j} <- sqrt(a.{j} *. a.{j});
    done
  done
;;






-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners