Bug 87

Summary: EventGarbageCollector is a performance bottleneck
Product: ns-3 Reporter: Gustavo J. A. M. Carneiro <gjcarneiro>
Component: coreAssignee: ns-bugs <ns-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: pre-release   
Hardware: All   
OS: All   
Attachments: screenshot of sysprof
sysprof profile after patch
patch
test patch (debugging bugzilla-- please ignore this patch)

Description Gustavo J. A. M. Carneiro 2007-10-10 10:52:41 UTC
... and I'm the one to blame for this :-/
Comment 1 Gustavo J. A. M. Carneiro 2007-10-10 10:53:22 UTC
Created attachment 75 [details]
screenshot of sysprof
Comment 2 Gustavo J. A. M. Carneiro 2007-10-10 12:32:55 UTC
Created attachment 76 [details]
sysprof profile after patch
Comment 3 Gustavo J. A. M. Carneiro 2007-10-10 14:01:19 UTC
Created attachment 79 [details]
patch
Comment 4 Gustavo J. A. M. Carneiro 2007-10-10 14:04:34 UTC
The comment for the previous patch is:

EventGarbageCollector was never supposed to be a singleton.  And in fact making it a regular member of Timer makes its performance much much better.  The reason is probably that this way we get many EventGarbageCollector instances, but each with a smaller event list.

We can see in the profile (previous attachment) that now EventGarbageCollector::Track is now significantly less a performance bottleneck.
Comment 5 Tom Henderson 2007-10-10 16:08:06 UTC
Created attachment 81 [details]
test patch (debugging bugzilla-- please ignore this patch)

Optional comment provided with the test patch
Comment 6 Mathieu Lacage 2007-10-11 10:06:09 UTC
> EventGarbageCollector was never supposed to be a singleton.  And in fact making
> it a regular member of Timer makes its performance much much better.  The
> reason is probably that this way we get many EventGarbageCollector instances,
> but each with a smaller event list.

Yes, this is quite true. But we cannot really add an EventGarbageCollector instance per Timer: it would be a bit overkill. Instead, we could remove this feature from Timer and ask our users to use the EventGarbageCollector separately.

I have done just that in ns-3-dev. I leave the rest of the optimization problems to you.
Comment 7 Gustavo J. A. M. Carneiro 2007-10-11 12:41:39 UTC
OK, I optimized this using list (actually multiset) sorted by time; got a 27% improvement in my OLSR simulation script, and now EventGarbageCollector is nowhere to be found in sysprof ;-)

It's in the OLSR tree: http://code.nsnam.org/gjc/ns-3-olsr/rev/0ca4a39dca8b