Browse thread
[Caml-list] interesting array efficiency observations
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Xavier Leroy <xavier.leroy@i...> |
| Subject: | Re: [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 ? Yes. When compiling to bytecode (or at the top-level), all bigarray accesses go through a generic access function that is polymorphic over the number of dimensions, the array type and the array layout, and is therefore somewhat expensive. When compiling to native code, efficient inline code is generated instead for accesses to 1, 2 and 3-dimensional arrays, provided the full type of the bigarray (including layout and element type) is known. In this case, the inline access code is almost as efficient as that for accessing a regular array: just one extra indirection. - Xavier Leroy ------------------- 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