Boost logo

Boost :

From: jsiek_at_[hidden]
Date: 2000-01-29 18:51:54

Mark Borgerding writes:
> It seems that the major difference is due to the fact that the default
> constructor for shared_ptr allocates a long on the heap (I didn't realize
> it did that).
> In my original test, which tested copy construction,assignment and default
> construction operations with equal frequency, linked_ptr won hands down.
> However, upon closer examination, it looks like shared_ptr is actually
> faster in 2 out of 3 of those operations. I tested the operations
> separately and recorded the following times for 10E6 iterations.

Yeah, that default constructor was scewing things a lot.

Taking a closer look at it, there isn't much register allocation going
on for either cases. Looks like the presence of structs is messing
things up. Even with KCC it's not doing lightweight object
optimization for this :( One reason for KCC not doing this may be
because the address of the pointer objects is being taken.

Without register allocation, there really isn't any difference
between going to the stack or the heap, so as Greg pointed out
there will be about 2X more memory refs for linked ptr in
just copying.



Boost list run by bdawes at, gregod at, cpdaniel at, john at