On Oct 30, 2005, at 02:51 PM, Lawrence Sanbourne wrote:
Do the STL stacks, vectors, and other collections automatically copy
the memory referenced by a pointer? This would surprise me.
STL would copy the pointer, not the data referenced. This isn't
really an issue however...
This code (internally) still has to allocate some new memory, use copy
the stuff at the FSRef * to it.
So, I'm well aware of the convenience of the STL, but I have no reason
to believe it's faster than CF.
Well, presumably if you used STL you wouldn't use FSRef*, but FSRef
directly and let the STL classes store the data directly, reducing
the number of memory allocations you need. Also, std::vector will
double it's storage allocation every time it has to increase the
size, making for amortized constant insertion/deletion when dealing
with the end of the vector (as you would with a stack). Presumably CF
would do the same thing, however the additional step of allocating
memory for the FSRef to be stored in the CFDataRef, as well as all of
the CF callbacks necessary (the retain/release that occurs when you
add it to the array) makes it seem as if CF will be slower.
Additionally, using STL will get you inlined code, whereas with CF
your crossin a dylib boundary to get to the code necessary.
--
Reality is what, when you stop believing in it, doesn't go away.
Failure is not an option. It is a privilege reserved for those who try.
David Duncan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden