[Mono-list] Performance measurements / garbage collection

Paolo Molaro lupus@ximian.com
Wed, 17 Jul 2002 12:15:08 +0200

On 07/16/02 Tom Fransen wrote:
> has anybody experience with measuring the overhead induced by the garbage
> collector under Mono. On the MS platform I can use the performance monitor
> to 'see' when the GC is invoked and how much of the time is used for GC.
> I like to do similar things with Mono to study the behavior of the GC. How
> can I hook into the GC under Mono?

Well, it depends what info you want out of the GC. Some is already
exported from the GC class. Callbacks for object allocations still need
to be hooked to the profiling interface, but this is very easy to do.
If you needs hooks for when a collections starts and ends, I think libgc
doesn't provide an interface to get the info. It should not be hard to
add, though, since the library provides some info in a non-programmatic
way when you set the GC_PRINT_STATS env variable: the info may not be
accurate enough, though. We should probably contact the upstream author
about this.
You can also play with setting GC_INITIAL_HEAP_SIZE to different sizes:
the right value can give a 10-20% speed difference in some benchmarks.


lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better