<?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="2003/01/203d53f5ef719129cb2f7f8b230e4574"
  from="Chet Murthy &lt;chet@w...&gt;"
  author="Chet Murthy"
  date="2003-01-08T01:57:17"
  subject="Re: [Caml-list] Memory management dominates running time "
  prev="2003/01/676a8e37ee6228f5e1705ee7a8ffabb0"
  next="2003/01/87d5f328c77313794e409877b61422fb"
  prev-in-thread="2003/01/4cbf5f649cf4149c1b629b97bc73ddd2"
  next-in-thread="2003/01/733fceb4a11bd478e10971ac4ec213da"
  prev-thread="2003/01/d89aa4bddc31c6f04c1b3b3cc50d0853"
  next-thread="2003/01/8822d3df66a08ab1cf8eb00f8fdaf3de"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Memory management dominates running time">
<msg 
  url="2003/01/7100c562b1af5753ac217cb7460456f7"
  from="Jörgen_Gustavsson &lt;gustavss@c...&gt;"
  author="Jörgen_Gustavsson"
  date="2003-01-03T21:58:38"
  subject="[Caml-list] Memory management dominates running time">
<msg 
  url="2003/01/4cbf5f649cf4149c1b629b97bc73ddd2"
  from="Norman Ramsey &lt;nr@e...&gt;"
  author="Norman Ramsey"
  date="2003-01-05T18:00:40"
  subject="Re: [Caml-list] Memory management dominates running time ">
</msg>
<msg 
  url="2003/01/203d53f5ef719129cb2f7f8b230e4574"
  from="Chet Murthy &lt;chet@w...&gt;"
  author="Chet Murthy"
  date="2003-01-08T01:57:17"
  subject="Re: [Caml-list] Memory management dominates running time ">
<msg 
  url="2003/01/733fceb4a11bd478e10971ac4ec213da"
  from="Jörgen_Gustavsson &lt;gustavss@c...&gt;"
  author="Jörgen_Gustavsson"
  date="2003-01-08T12:58:39"
  subject="Re: [Caml-list] Memory management dominates running time ">
</msg>
</msg>
<msg 
  url="2003/01/e8ee9d44073ff9cb7d257fef86bc8f53"
  from="Damien Doligez &lt;damien.doligez@i...&gt;"
  author="Damien Doligez"
  date="2003-01-08T14:19:54"
  subject="Re: [Caml-list] Memory management dominates running time">
<msg 
  url="2003/01/ce7780f4e0c6590184c7fd1d4991712f"
  from="Christophe Raffalli &lt;Christophe.Raffalli@u...&gt;"
  author="Christophe Raffalli"
  date="2003-01-09T06:42:49"
  subject="[Caml-list] GlSurf 1.2 available">
</msg>
</msg>
</msg>
</thread>

<contents>

By using gprof, and doing a little careful counting, you can 
often find out where egregious allocations are happening, and
eliminate them.

I can't give you good pointers on this, because, well, it's a bit of
an art, and takes a lot of experience.  But it _is_ doable, and I have
done it to nontrivial programs in Caml, as well as in Java, attaining
speedups of 2x, 3x, without much code-restructuring.

E.g., once, I took a Stream-based parser, and wrote a Stream module
which only supported "char Stream", and only for parsing.

By writing a few auxiliary functions in addition to this, I was able
to reduce the consing associated with stream-based parsing (the
constant creation of "Some _" blocks) significantly, and got a rather
large speedup.

I was able to see that this was important, basically by looking around
in the gprof profile and trying to follow where the allocation were
happening.

--chet--
-------------------
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>

