[Ns-developers] A Reason for Slowness of NS3
Adrian Sai-Wah TAM
adrian at ieaa.org
Sat Feb 14 20:43:51 PST 2009
On Sat, Feb 14, 2009 at 11:30 PM, <craigdo at ee.washington.edu> wrote:
>> static TypeId Class::GetTypeId()
>> {
>> static TypeId tid = ....;
>> return tid;
>> }
>
> Isn't there a mechanism for optimizing exactly this situation? Return Value
> Optimization (RVO) or in this case, Named Return Value Optimization (NRVO)?
> Hasn't this been in gcc since release 3.something? Doesn't this
> optimization already elide the "extra" copy construction that we're
> discussing removing? I'm not following this thread in great detail, but
> isn't this particular case a solved problem?
Well...I am not a GCC expert, but if there is RVO, it should be the
case. Since I don't do optimization when passing things to gprof, I am
not sure if I input -O3 to gcc can reduce the number of calls.
>
> I must admit I'm getting a little confused about what exactly is being
> suggested and measured ...
In short, I suggested to do a tedious scan on the source code to
change class object as argument in function calls into const reference
as argument.
Some update: I found another potential candidate for converting
objects into references is the events in a scheduler. In the Invoke()
call, a significant amount of time is spent in MakeEvent<..>() calls.
- Adrian.
More information about the Ns-developers
mailing list