[Ns-developers] A Reason for Slowness of NS3
Tom Henderson
tomh at tomh.org
Fri Feb 13 14:09:35 PST 2009
George Riley wrote:
> Hi Adrian,
> THanks for posting this. I recall early on in the design discussions
> there was
> a lengthy debate about the merits of "pass by value" versus "pass by
> reference".
> The decision was, I believe, to use "const reference" where possible,
> precisely
> for the reason you describe below. The downside is, of course, an
> additional
> indirection when reading the values passed by reference. However, we did
> decide pass by reference was generally the best approach. Clearly, this
> was
> not always done, but would support your suggested change. We may want to
> make a more thorough pass looking for any other high-overhead object copies
> for pass by value.
>
> Tom, feel free to comment. Is my memory correct on this?
>
We decided for preferring pass by reference to const when pass-by-value
semantics are desired. It hasn't been uniformly followed in the
codebase; I think we also loosely agreed that we would optimize things
once we had profiling data to support it. Looking at this case, it
seems like a reasonable suggestion (and for other instances where we
find them at the top of the list).
Tom
More information about the Ns-developers
mailing list