<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2002/12/10c241f2ed21743f8c2a8b921f2fa9dc"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-12-03T15:34:06"
  subject="Re: [Caml-list] BigArray.Array2 vs Array.make_matrix"
  prev="2002/12/0e39279b83c2eff49d6e78d3e3825c0a"
  next="2002/12/ee8d6efbea65dad49bf887060ced30d3"
  prev-in-thread="2002/11/2e041b806f298248d1770977e5f400de"
  prev-thread="2002/11/1f340e7bc8861b937e5a5127b7ba31f1"
  next-thread="2002/11/747066720d18c4f40107f5cad6eae619"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] BigArray.Array2 vs Array.make_matrix">
<msg 
  url="2002/11/2e041b806f298248d1770977e5f400de"
  from="Kevin Patrick Murphy &lt;murphyk@a...&gt;"
  author="Kevin Patrick Murphy"
  date="2002-11-28T03:22:28"
  subject="[Caml-list] BigArray.Array2 vs Array.make_matrix">
<msg 
  url="2002/12/10c241f2ed21743f8c2a8b921f2fa9dc"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-12-03T15:34:06"
  subject="Re: [Caml-list] BigArray.Array2 vs Array.make_matrix">
</msg>
</msg>
</thread>

<contents>
&gt; I was wondering what are the relative merits (in terms of speed,
&gt; portability and ease of use) between using arrays of arrays, and the
&gt; BigArray class.
&gt; 
&gt; While web browsing, I saw a couple of people claim that BigArray is
&gt; signigicantly slower than the standard array class:
&gt; 
&gt; http://caml.inria.fr/archives/200105/msg00217.html
&gt;  claims BigArray is 3 times slower
&gt; 
&gt; www.cs.cornell.edu/courses/cs612/2001sp/ projects/ocaml-arrays/OCaml.pd
&gt;  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:

http://pauillac.inria.fr/bin/wilma_hiliter/caml-list/200207/msg00445.html

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 &gt;= 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.

&gt; Plus an interface to some standard linear algebra code would be nice...

You mean, like LACAML?
  http://www.ai.univie.ac.at/~markus/home/ocaml_sources.html

- 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

</contents>

</message>

