Bug 87 - EventGarbageCollector is a performance bottleneck
EventGarbageCollector is a performance bottleneck
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: core
pre-release
All All
: P3 normal
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-10-10 10:52 UTC by Gustavo J. A. M. Carneiro
Modified: 2007-10-11 12:41 UTC (History)
0 users

See Also:


Attachments
screenshot of sysprof (78.85 KB, image/png)
2007-10-10 10:53 UTC, Gustavo J. A. M. Carneiro
Details
sysprof profile after patch (85.64 KB, image/png)
2007-10-10 12:32 UTC, Gustavo J. A. M. Carneiro
Details
patch (1.63 KB, patch)
2007-10-10 14:01 UTC, Gustavo J. A. M. Carneiro
Details | Diff
test patch (debugging bugzilla-- please ignore this patch) (16 bytes, patch)
2007-10-10 16:08 UTC, Tom Henderson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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