GC performance - GC fragility
- From: Eric Grange <egrangeNO@xxxxxxxxxxxxxxx>
- Date: Wed, 23 Jan 2008 10:07:48 +0100
As a followup to the GC perf thread, I posted a small tweak of the benchmark in the attachments (under Pierre's post), to illustrate how wrong and how easily things can go with a GC (and how tricky benchmarking memory managers outside of real-world applications is).
Basicly the original test was allocating an object with single TStringList field, and added a single short string before "releasing" the whole (ie. it wouldn't stress the markup/compaction phase of the GC at all).
My variation adds a bunch of data fields to the TTestObject (in the form of a static array, to keep the code short), along with a reference to a subobject (another TTestObject).
Instead of allocating a single object at each benchmark step, several objects are then allocated, each (but the last) with a reference to the next object in the singly-linked chain.
The outcome?
FastMM now runs it 6 times faster (not 6%), and uses more than 4 times less memory (on a dual core).
Sean, this is an example why a GC can be considered "hideously" slow: its execution complexity isn't constant (unlike FastMM), and the more you stress it, the less efficient it becomes at managing memory.
Further modification of the test so that FastMM can be found to run as many times faster than the GC as desired is left as an exercice to the astute reader ;)
As a counter-exercice and challenge, I suggest finding a variation of the test where the GC ends up running significantly faster (at least twice faster) and using less memory (at least half).
Eric
.
- Follow-Ups:
- Re: GC performance - GC fragility
- From: Marco Caspers
- Re: GC performance - GC fragility
- From: Q Correll
- Re: GC performance - GC fragility
- From: Steve Thackery
- Re: GC performance - GC fragility
- From: Sean Cross
- Re: GC performance - GC fragility
- From: Slagert
- Re: GC performance - GC fragility
- From: James Smith
- Re: GC performance - GC fragility
- From: Atmapuri
- Re: GC performance - GC fragility
- Prev by Date: Re: Is dbExpress a dead end?
- Next by Date: Re: Garbage collection - performance test
- Previous by thread: Delphi in a VM.. VM on remote machine
- Next by thread: Re: GC performance - GC fragility
- Index(es):
Relevant Pages
|