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
[Caml-list] BigArray.Array2 vs Array.make_matrix
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <xavier.leroy@i...>
Subject: Re: [Caml-list] BigArray.Array2 vs Array.make_matrix
> I was wondering what are the relative merits (in terms of speed,
> portability and ease of use) between using arrays of arrays, and the
> BigArray class.
> While web browsing, I saw a couple of people claim that BigArray is
> signigicantly slower than the standard array class:
>  claims BigArray is 3 times slower
> projects/ocaml-arrays/OCaml.pd
>  claims BigArray is about 10 times slower

There are earlier discussions of this issue in the archives of the
caml-list.  See for instance my reply:

In general, bigarrays are slower than regular arrays, although the
slowdown depends a lot on how the code is written, e.g. ensuring that
bigarrays are fully monomorphic improves performance quite a lot.

The main purpose of bigarrays is not to speed up pure Caml code, but
to facilitate interfacing with external numerical libraries.

In some circumstances, bigarrays have a few added bonuses as well:
compact representation of arrays of small floats, small integers, and
complex numbers; support for dimensions >= 2^22 on 32-bit machines;
and no-copying slicing and shrinking operations.  But all this comes
at some expense in speed for raw array accesses.

> Plus an interface to some standard linear algebra code would be nice...

You mean, like LACAML?

- Xavier Leroy
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: