Hi,

On Thu, May 28, 2009 at 10:22:08AM +0200, Christoph Spiel wrote:
> On Tue, May 26, 2009 at 07:02:16PM +0200, Gabriel Kerneis wrote:
> > I've been suffering performance issues with CIL recently. 30% of the
> > time was spent in garbage collection.
> 
> (1) Recompile the run-time environment of OCaml
> with the best known combination of optimization
> flags.  This may speed up the garbage collector
> a little bit.

This might not be enough for me, see below.

> (2) Drastically increase the heap size.  (Of
> course this action is limited by the amount of
> memory in the target machines.)

This reduces the number of collections A LOT but doesn't really cut the
time down, because there too many words allocated.

> (3) Rewrite the analysis to be less functional.
> I had a functional implementation of my analysis
> that used a lot of [Buffer]s for the output:
> many of them and with a large total size.
> Rewriting it to a more procedural style which
> meant immediate output of the string data to the
> results file dramatically reduced the load on
> the GC, increased the performance a lot, and at
> the same time reduced the program's memory
> footprint.

Well, most of my trouble come from a single visitor which has to go
through my program many times. Sadly, I'm not analysing anything, but
rather transforming the source code. I'm as imperative as can be
(everything is mutated in place), but sadly cil.ml is full of partial
applications. Hence my patches.

Just to give you an idea of the figures involved:
  Memory statistics: total=1173.63Mb, max=3.56Mb, minor=1173.54Mb,
  major=125.06Mb, promoted=124.97Mb
  minor collections=8953  major collections=129 compactions=0

With your tune_garbage_collector(), I got:
  Memory statistics: total=1173.51Mb, max=34.54Mb, minor=1173.42Mb,
  major=16.48Mb, promoted=16.39Mb
  minor collections=323  major collections=18 compactions=3

Which looks like a big win, but the time spent allocating the 1.2Gb
of minor words kills everything else (moreover I'm on 64bit, so it's
2.4Gb in fact).

Thanks anyway for your advice,
-- 
Gabriel Kerneis

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to